It’s said that the error numbers like EINVAL, ENOMEM, etc. are defined in errno.h, but I can’t find them in errno.h, I also searched some directories under /usr/include, still can’t find them. I can use these macros without any issue in my C code. Anyone can tell me where are them?
It's up to the implementation of the standard C library.
All that is certain is that <errno.h>
is the top-level header that application code should use.
One way of figuring out is to trace an invocation of the compiler.
It is defined either directly in errno.h or in a file included (directly or indirectly) by errno.h.
I searched for it using the following command:
find /usr/include | xargs grep ENOMEM | grep '#define'
and I found a match in /usr/include/asm-generic/errno-base.h
in my linux (RHEL 6).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With