On Thu, Jan 06, 2000 at 03:52:48PM +0800, Du Jinsong wrote:
> Hi, I noticed an e-mail by Alan Cox regarding this issue on August, 1999
>   http://www.uwsg.indiana.edu/hypermail/linux/net/9908.1/0018.html
> According to him Linux does not need sa_len/sin_len, thus did not
> implement them.
> 
> But when porting applications from BSD to Linux, how to circumvent this
> problem?

Auto-config with this test:
(Example I pulled from ZMailers aclocal.m4)

AC_DEFUN(AC_STRUCT_SA_LEN,
[dnl
#
# Test to see, if we have BSD4.4  sa_len -field in the "struct sockaddr*"
#
AC_CACHE_CHECK([for 'sa_len' in 'struct sockaddr'], ac_cv_struct_sa_len,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>], [struct sockaddr sa; sa.sa_len = 0; ],
        ac_cv_struct_sa_len=yes, ac_cv_struct_sa_len=no)])
if test "$ac_cv_struct_sa_len" = yes; then
  AC_DEFINE(HAVE_SA_LEN)
fi
])


Then just have  ``#ifdef HAVE_SA_LEN''  around relevant places in
the source code.

Very simple.

> Thanks a lot!
> // jinsong

/Matti Aarnio <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to