Is there a way to get "EINVAL" style string
Hello
I was looking at the man pages looking for a way to get a string of the errno value meaning. This is kind of a user question.
This API returns "returns a pointer to a string that describes the error code":
http://man7.org/linux/man-pages/man3/strerror.3.html
However, this is a description, e.g. "Invalid argument". Is there a function that would return "EINVAL" or "ENOENT" as the string?
Could I suggest that the text on the man page be updated to clarify what would be returned:
"returns a pointer to a string that describes the error code. e.g. "Invalid argument" if EINVAL was the errnum."
Best regards, Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jon,
Quoted 5 lines · Jon Grant
Hello
I was looking at the man pages looking for a way to get a string of the errno value meaning. This is kind of a user question.
Quoted 7 lines
This API returns "returns a pointer to a string that describes the error code":
http://man7.org/linux/man-pages/man3/strerror.3.html
However, this is a description, e.g. "Invalid argument". Is there a function that would return "EINVAL" or "ENOENT" as the string?
None that I know of. (In passing, I dealt with exactly this problem for my book with a script that generated the string names; see
http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)
Quoted 5 lines
Could I suggest that the text on the man page be updated to clarify what would be returned:
"returns a pointer to a string that describes the error code. e.g. "Invalid argument" if EINVAL was the errnum."
Done for 3.40.
Cheers,
Michael
Signature · 7 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Michael
Quoted 13 lines · Michael Kerrisk (man-pages)
Hi Jon,
Quoted 10 lines · Jon Grant
Hello
I was looking at the man pages looking for a way to get a string of the errno value meaning. This is kind of a user question.
This API returns "returns a pointer to a string that describes the error code":
Quoted 7 lines
Quoted 2 lines
However, this is a description, e.g. "Invalid argument". Is there a function that would return "EINVAL" or "ENOENT" as the string?
None that I know of. (In passing, I dealt with exactly this problem for my book with a script that generated the string names; see
http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)
Interesting. I saw on the ename.c page that the numbers were in the table hard coded -- is it guaranteed that 90 will always correspond to EPROTOTYPE on a unixy system?
Quoted 7 lines
Quoted 5 lines
Could I suggest that the text on the man page be updated to clarify what would be returned:
"returns a pointer to a string that describes the error code. e.g. "Invalid argument" if EINVAL was the errnum."
Done for 3.40.
Great, thank you!
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jon,
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
I was looking at the man pages looking for a way to get a string of the errno value meaning. This is kind of a user question.
This API returns "returns a pointer to a string that describes the error code":
Quoted 8 lines
Quoted 2 lines
However, this is a description, e.g. "Invalid argument". Is there a function that would return "EINVAL" or "ENOENT" as the string?
None that I know of. (In passing, I dealt with exactly this problem for my book with a script that generated the string names; see
http://man7.org/tlpi/code/online/dist/lib/ename.c.inc.html and
http://man7.org/tlpi/code/online/dist/lib/error_functions.c.html)
Quoted 3 lines
Interesting. I saw on the
ename.cpage that the numbers were in the table hard coded -- is it guaranteed that 90 will always correspond to EPROTOTYPE on a unixy system?
No. So, my build code deals with this by using a script to build a platform-specific ename.c.inc file (have a look at the tarball.)
Thanks,
Michael
Signature · 7 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html