You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by John Mark Vandenberg <ja...@gmail.com> on 2006/04/15 03:41:27 UTC

[patch 09/17] struct iovec

struct iovec is needed to emulate Unix writev.  This patch moves
the workaround from apr.hw to apr_want.h to it can be shared by
any platform without it.

AC_CHECK_TYPE has problems determining whether this type exists.

The change to build/apr_common.m4 allows APR_CHECK_SIZEOF_EXTENDED
to be called with a space in the argument.

Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -1438,6 +1438,14 @@ case $host in
         ;;
 esac
 
+APR_CHECK_SIZEOF_EXTENDED([#include <sys/uio.h>],struct iovec,0)
+if test "$ac_cv_sizeof_struct_iovec" = "0"; then
+    have_iovec=0
+else
+    have_iovec=1
+fi
+
+
 AC_SUBST(voidp_size)
 AC_SUBST(short_value)
 AC_SUBST(int_value)
@@ -1459,6 +1467,7 @@ AC_SUBST(uint64_literal) 
 AC_SUBST(stdint) 
 AC_SUBST(bigendian)
 AC_SUBST(aprlfs)
+AC_SUBST(have_iovec)
 
 dnl ----------------------------- Checking for string functions
 AC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0")
Index: include/apr.h.in
===================================================================
--- include/apr.h.in.orig
+++ include/apr.h.in
@@ -220,6 +220,7 @@ extern "C" {
 #define APR_HAVE_STRUCT_RLIMIT  @struct_rlimit@
 #define APR_HAVE_UNION_SEMUN    @have_union_semun@
 #define APR_HAVE_SCTP           @have_sctp@
+#define APR_HAVE_IOVEC          @have_iovec@
 
 /*  APR Feature Macros */
 #define APR_HAS_SHARED_MEMORY     @sharedmem@
Index: include/apr_want.h
===================================================================
--- include/apr_want.h.orig
+++ include/apr_want.h
@@ -81,10 +81,28 @@
 
 #ifdef APR_WANT_IOVEC
 
+#if APR_HAVE_IOVEC
+
 #if APR_HAVE_SYS_UIO_H
 #include <sys/uio.h>
 #endif
 
+#else
+
+struct iovec
+{
+    char *iov_base;
+    int  iov_len;
+};
+
+#endif
+
+/* apr_want is included at several layers; redefining APR_HAVE_IOVEC
+ * to ensure struct is not introduced several times
+ */
+#undef APR_HAVE_IOVEC
+#define APR_HAVE_IOVEC 1
+
 #undef APR_WANT_IOVEC
 #endif
 
Index: build/apr_common.m4
===================================================================
--- build/apr_common.m4.orig
+++ build/apr_common.m4
@@ -446,9 +446,9 @@ dnl
 AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED],
 [changequote(<<,>>)dnl
 dnl The name to #define
-define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
+define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z ], [A-Z_]))dnl
 dnl The cache variable
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *],[<p>]))dnl
+define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [A-Z ],[a-z_]))dnl
 changequote([, ])dnl
 AC_MSG_CHECKING(size of $2)
 AC_CACHE_VAL(AC_CV_NAME,
Index: include/apr.hw
===================================================================
--- include/apr.hw.orig
+++ include/apr.hw
@@ -487,10 +487,7 @@ typedef  int         gid_t;
 typedef int apr_wait_t;
 
 /* struct iovec is needed to emulate Unix writev */
-struct iovec {
-    char*      iov_base;
-    apr_size_t iov_len;
-};
+#define APR_HAVE_IOVEC 0
 
 /* Nasty Win32 .h ommissions we really need */
 #define STDIN_FILENO  0

--

Re: [patch 09/17] struct iovec

Posted by Max Bowsher <ma...@ukf.net>.
Justin Erenkrantz wrote:
> On 4/14/06, John Mark Vandenberg <ja...@gmail.com> wrote:
>> struct iovec is needed to emulate Unix writev.  This patch moves
>> the workaround from apr.hw to apr_want.h to it can be shared by
>> any platform without it.
>>
>> AC_CHECK_TYPE has problems determining whether this type exists.
> 
> This part is committed in r421075.
> 
>> The change to build/apr_common.m4 allows APR_CHECK_SIZEOF_EXTENDED
>> to be called with a space in the argument.
> 
> This is committed in r421074.  (Do you have any clue what those P and
> p's were for?)

They were for handling pointer types. r421074 changed the
transliterations incorrectly - I've reimported the correct versions from
 autoconf 2.59 in r421091:

-define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z ], [A-Z_]))dnl
+define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl

-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [A-Z ],[a-z_]))dnl
+define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl

Max.


Re: [patch 09/17] struct iovec

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 4/14/06, John Mark Vandenberg <ja...@gmail.com> wrote:
> struct iovec is needed to emulate Unix writev.  This patch moves
> the workaround from apr.hw to apr_want.h to it can be shared by
> any platform without it.
>
> AC_CHECK_TYPE has problems determining whether this type exists.

This part is committed in r421075.

> The change to build/apr_common.m4 allows APR_CHECK_SIZEOF_EXTENDED
> to be called with a space in the argument.

This is committed in r421074.  (Do you have any clue what those P and
p's were for?)

Thanks!  -- justin