-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate errno definitions from CSV #15579
base: master
Are you sure you want to change the base?
Conversation
this is a machine-friendly version of errno.h using this file, i plan to generate: * the corresponding C definitions in errno.h. * strerror tables. * host <-> nuttx errno conversion logic for sim.
[Experimental Bot, please feedback here] Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary. This PR does not fully meet the NuttX requirements. While it provides a summary of what is being changed, it lacks crucial details. Here's what's missing:
The PR needs to provide significantly more detail to be considered complete. Addressing the above points will make it easier for reviewers to understand and evaluate the change. |
i have a question: is python acceptable for this kind of tools these days? |
I don't think so, or I missed something. If the build system is to depend on python, then this is a more serious issue to discuss in the community. Or was it introduced quietly and no one noticed? EDIT: if python is used to generate the file, but not when build process, then it's probably OK? |
the script this PR added (mkerrno.py) is not meant to be used during a build. otoh, some of existing python scripts in the tools dir seem to be used during a build. |
then it's definitely ok.
yeah, I just saw this. So it was introduced without much discussion and even requirements in the documentation hasn't been updated. I see it's only for the case when KASAN is enabled, but this doesn't change the fact that python is now required to build.... |
@yamt what's the benefit to generate the errno from a csv, but not modify errno.h direclty? |
i want to generate other things as well, which are difficult or impossible with C preprocessor. #if defined(EPERM)
case EPERM: return NUTTX_EPERM;
#endif |
I still can't fully understand what you want to achieve with this code snippet, could you explain more? In most case, it's be better to complish the generation work as macro as we can. |
but why not generate automatically?
both(kasan.py and mkallsyms.py) are advanced features, which are disabled by default. so python isn't required before you enable these from defconfig. But, I need mention that shell script(include the tools invoked in it) is hard to work in Windows native environment. If we want to improve the Windows native develop experience, python is the best script we can choice. |
convert host errno to nuttx errno.
i can't think of any way to do the equivalent with C preprocessor alone. |
why not simply define EINVAL_LINUX, EINVAL_MACOS, EINVAL_WINDOWS directly, instead through errno_xxx.csv and mkerrno.py.
sorry, I don't see any hard block issue to implement the conversion in c entirely. |
EPREM in the above snippet is the host one. (just use the host errno.h)
well, of course, i can keep the csv and script private and only submit the generated C files to nuttx. |
because
|
Does your solution share one errno.csv for all OS or have the seperate errno.csv for each OS? The complex of include/errno.csv and include/errno.h is almost same, so whether we can share the same errno.csv is a key point. |
errno.csv only defines things for nuttx. i have no plan to have csv files for other OSes. (linux, macos, etc) |
So, why do we introduce errno.csv? It's more simple to modify errno.h directly to add/remove/change errno.
Sorry, I still can't understand how csv could help to fix hostfs issue. With the current patchset, I don't see any benefit to generate errno.h from mkerrno.py and errno.csv. |
because, as explained in the commit message, i want to generate more than errno.h (and automatically keep them consistent)
there is no benefit from this PR alone because it only generates errno.h at this point. |
could you provide other patch? so I can understand the whole picture. |
ok. (it might take a bit long to find time to work on this.) |
Summary
generate errno definitions from a CSV file for flexibility.
i plan to use this CSV file for other things like host <-> nuttx errno conversion logic.
Impact
Testing