Use IOV_MAX instead of UIO_MAXIOV
IOV_MAX appears to be more portable than UIO_MAXIOV.
* msghdr.c: Include <limits.h>. Remove fallback defintion of UIO_MAXIOV.
(get_optmem_max): Replace UIO_MAXIOV with IOV_MAX.
* tests/msg_control.c: Likewise.
diff --git a/msghdr.c b/msghdr.c
index 1d158b7..63f5171 100644
--- a/msghdr.c
+++ b/msghdr.c
@@ -31,6 +31,7 @@
#include "defs.h"
#include "msghdr.h"
+#include <limits.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -229,10 +230,6 @@
}
}
-#ifndef UIO_MAXIOV
-# define UIO_MAXIOV 1024
-#endif
-
static unsigned int
get_optmem_max(void)
{
@@ -241,7 +238,7 @@
if (!optmem_max) {
if (read_int_from_file("/proc/sys/net/core/optmem_max",
&optmem_max) || optmem_max <= 0) {
- optmem_max = sizeof(long long) * (2 * UIO_MAXIOV + 512);
+ optmem_max = sizeof(long long) * (2 * IOV_MAX + 512);
} else {
optmem_max = (optmem_max + sizeof(long long) - 1)
& ~(sizeof(long long) - 1);