perror
重点学习 errnum 转 str 的实现方法
- 妙
- 妙
- 妙
- 妙
perror
stdio-common/perror.c
perror (const char *s)
static void perror_internal (FILE *fp, const char *s, int errnum)
__strerror_r
string/_strerror.c
/* Return a string describing the errno code in ERRNUM. */
char *
__strerror_r (int errnum, char *buf, size_t buflen)
{
char *err = (char *) __get_errlist (errnum);
if (__glibc_unlikely (err == NULL))
{
__snprintf (buf, buflen, "%s%d", _("Unknown error "), errnum);
return buf;
}
return _(err);
}
__get_errlist
stdio-common/errlist.c