-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Consistent errno values #976
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
Comments
Aside: I know system call indexes are different on different architectures as well. On my raspberry pi (which is running an ARM processor), errno.ETIMEDOUT has the value 110. I looked on cygwin, and in python there, errno.ETIMEDOUT == 116 (and ETIMEDOUT is defined as 116 in /usr/include/sys/errno.h) posix only defined the name of the error and not its value. So I think that the right thing to do is to use whatever value of ETIMEDOUT is defined for the platform. |
That sucks. Linux ABI is very inconsistent ;-( I assume the question is either:
|
I hit this today with #1533 . It gave error 116, and I had to go to compiler includes to find that it's ETIMEDOUT. |
Yeah, it's super annoying. I want to provide a built-in errno module for stmhal. Either as frozen module, persistent-bytecode or implemented in C, it doesn't matter, as long as "import errno" works on pyboard out-of-the-box without needing anything in the filesystem. But, regardless of having built-in errno, we still need to decide whether to use port-specific errno values, or go for a fixed one. |
Well, I forgot to add to my previous comment that I still find it mildly annoying ;-). Otherwise, just was doing bug triaging and found what to add to this old issue. I don't think it's big priority, but I'd give +0.5 for having a MICROPY_* config value, which, being defined, causes py/mpconfig.h to define typical error constants to standard values (either taken from Linux, or in the range beyond usual used by OS errors, to let differentiate them if they ever may be mixed in one port). |
+1 for builtin errno, and I vote for fixed values.
|
If we're going to have a builtin module then it would need to be named "uerrno" with weak link called "errno". |
Yes, good point.
|
uPy now provides its own errno's in py/mperrno.h. From now on all errno symbols in code should use the MP_Exxx version. A uerrno module is also provided, disabled by default. |
Test the BOARD parameter for nullness
On my linux box, native compilation has ETIMEDOUT with a value 110. But cross compiling using arm-none-eabi gives ETIMETOUT a value of 116. What to do here? Which value to use?
The text was updated successfully, but these errors were encountered: