summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-02-24 21:06:48 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-02-26 00:09:04 +1100
commit2eb4041493fd2635ffdc64a852d02b38c4955e0b (patch)
treea5f41e6d849ade478c674d463a3bd6774a74a543
parent6c8c9a615b6d31db8a87bc25033f053d5b0a831e (diff)
Add prototype for readv if needed.
-rw-r--r--configure.ac2
-rw-r--r--openbsd-compat/openbsd-compat.h10
2 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 7342dcb7..03cc3f86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1908,7 +1908,7 @@ AC_CHECK_DECLS([O_NONBLOCK], , ,
#endif
])
-AC_CHECK_DECLS([writev], , , [
+AC_CHECK_DECLS([readv, writev], , , [
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 8155a0dd..b48fb934 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -170,10 +170,18 @@ int BSDgetopt(int argc, char * const *argv, const char *opts);
#include "openbsd-compat/getopt.h"
#endif
-#if defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0
+#if ((defined(HAVE_DECL_READV) && HAVE_DECL_READV == 0) || \
+ (defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0))
# include <sys/types.h>
# include <sys/uio.h>
+
+# if defined(HAVE_DECL_READV) && HAVE_DECL_READV == 0
+int readv(int, struct iovec *, int);
+# endif
+
+# if defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0
int writev(int, struct iovec *, int);
+# endif
#endif
/* Home grown routines */