Skip to content

Commit 1bd762a

Browse files
committed
Merge branch 'posix-errnos' of https://github.com/minwooim/fio
* 'posix-errnos' of https://github.com/minwooim/fio: options: add support more POSIX errnos
2 parents 4db5740 + 7b003c1 commit 1bd762a

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

options.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,40 @@ static int str2error(char *str)
525525
"EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
526526
"EINVAL", "ENFILE", "EMFILE", "ENOTTY",
527527
"ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
528-
"EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
528+
"EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE",
529+
"EDEADLK", "ENAMETOOLONG", "ENOLCK", "ENOSYS", "ENOTEMPTY",
530+
"ELOOP", "EWOULDBLOCK", "ENOMSG", "EIDRM", "ECHRNG",
531+
"EL2NSYNC", "EL3HLT", "EL3RST", "ELNRNG", "EUNATCH",
532+
"ENOCSI", "EL2HLT", "EBADE", "EBADR", "EXFULL",
533+
"ENOANO", "EBADRQC", "EBADSLT", "EDEADLOCK", "EBFONT",
534+
"ENOSTR", "ENODATA", "ETIME", "ENOSR", "ENONET",
535+
"ENOPKG", "EREMOTE", "ENOLINK", "EADV", "ESRMNT",
536+
"ECOMM", "EPROTO", "EMULTIHOP", "EDOTDOT", "EBADMSG",
537+
"EOVERFLOW", "ENOTUNIQ", "EBADFD", "EREMCHG", "ELIBACC",
538+
"ELIBBAD", "ELIBSCN", "ELIBMAX", "ELIBEXEC", "EILSEQ",
539+
"ERESTART", "ESTRPIPE", "EUSERS", "ENOTSOCK", "EDESTADDRREQ",
540+
"EMSGSIZE", "EPROTOTYPE", "ENOPROTOOPT", "EPROTONOSUPPORT", "ESOCKTNOSUPPORT",
541+
"EOPNOTSUPP", "EPFNOSUPPORT", "EAFNOSUPPORT", "EADDRINUSE", "EADDRNOTAVAIL",
542+
"ENETDOWN", "ENETUNREACH", "ENETRESET", "ECONNABORTED", "ECONNRESET",
543+
"ENOBUFS", "EISCONN", "ENOTCONN", "ESHUTDOWN", "ETOOMANYREFS",
544+
"ETIMEDOUT", "ECONNREFUSED", "EHOSTDOWN", "EHOSTUNREACH", "EALREADY",
545+
"EINPROGRESS", "ESTALE", "EUCLEAN", "ENOTNAM", "ENAVAIL",
546+
"EISNAM", "EREMOTEIO", "EDQUOT", "ENOMEDIUM", "EMEDIUMTYPE",
547+
"ECANCELED", "ENOKEY", "EKEYEXPIRED", "EKEYREVOKED", "EKEYREJECTED",
548+
"EOWNERDEAD", "ENOTRECOVERABLE", "ERFKILL", "EHWPOISON" };
529549
int i = 0, num = sizeof(err) / sizeof(char *);
550+
int retval;
530551

531552
while (i < num) {
532-
if (!strcmp(err[i], str))
533-
return i + 1;
553+
if (!strcmp(err[i], str)) {
554+
retval = i + 1;
555+
/* Handle errno aliases that should map to actual errno values */
556+
if (!strcmp(str, "EWOULDBLOCK"))
557+
retval = EAGAIN;
558+
else if (!strcmp(str, "EDEADLOCK"))
559+
retval = EDEADLK;
560+
return retval;
561+
}
534562
i++;
535563
}
536564
return 0;

0 commit comments

Comments
 (0)