cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getnameinfo() args

From: Jamie Lokier <jamie_at_shareable.org>
Date: Thu, 15 Dec 2005 02:04:28 +0000

Yang Tse wrote:
> An experimental check for getnameinfo() argument types named
> CURL_FUNC_GETNAMEINFO_ARGTYPES has been commited to CVS.
>
> http://cool.haxx.se/cvs.cgi/curl/acinclude.m4?rev=1.56&content-type=text/vnd.viewcvs-markup
>
> _Any_ comments are welcome.

In my own library, I use the a macro very much like the following to
define 'socklen_t' unconditionally. Then I use 'socklen_t' in the
places where it is supposed to be used nowadays. Do you know if this
is enough for getnameinfo(), or is a second test _specifically_ for
getnameinfo() required as well? In other words, could you try using
this macro on those systems where you've noticed the getnameinfo()
problem?

Thanks,
-- Jamie

dnl JL_AC_TYPE_SOCKLEN_T
dnl
dnl Define socklen_t to an appropriate type if it's not defined
dnl in <sys/socket.h> or other header files.

AN_IDENTIFIER([socklen_t], [JL_AC_TYPE_SOCKLEN_T])
AC_DEFUN([JL_AC_TYPE_SOCKLEN_T],
[AC_CHECK_TYPE(socklen_t, [],
  [AC_CACHE_CHECK([type equivalent to socklen_t], [jl_cv_type_socklen_t],
[for ac_arg in 'int' 'size_t' 'unsigned' 'long' 'unsigned long'; do
  AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM(
[[AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
extern int accept (int, struct sockaddr *, $ac_arg *);]],
[[$ac_arg len = 0; accept (0, (struct sockaddr *) 0, &len);]])],
[jl_cv_type_socklen_t="$ac_arg"; break])
done
# Provide a safe default value.
: ${jl_cv_type_socklen_t='int'}
])
AC_DEFINE_UNQUOTED([socklen_t], [$jl_cv_type_socklen_t], [Define the type to use for `socklen_t' if the system does not define (usually `int' or `size_t', in <sys/types.h> or <sys/socket.h>).])],
[AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif])])

-- Jamie
Received on 2005-12-15