unix: fix uv__getiovmax return value

On some embedded devices (arm-linux-uclibc based ip camera),
sysconf(_SC_IOV_MAX) can not get the correct value. The return
value is -1 and the errno is EINPROGRESS. Degrade the value to 1.

PR-URL: https://github.com/libuv/libuv/pull/573
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
HungMingWu 2015-10-13 06:13:51 +00:00 committed by Ben Noordhuis
parent bf52579f92
commit 9fbcca0481

View File

@ -204,8 +204,14 @@ int uv__getiovmax(void) {
return IOV_MAX;
#elif defined(_SC_IOV_MAX)
static int iovmax = -1;
if (iovmax == -1)
if (iovmax == -1) {
iovmax = sysconf(_SC_IOV_MAX);
/* On some embedded devices (arm-linux-uclibc based ip camera),
* sysconf(_SC_IOV_MAX) can not get the correct value. The return
* value is -1 and the errno is EINPROGRESS. Degrade the value to 1.
*/
if (iovmax == -1) iovmax = 1;
}
return iovmax;
#else
return 1024;