[kaffe] libraries/clib/net/InetAddressImpl.c cannot be compiled on old Linux

Dalibor Topic robilad@yahoo.com
Fri Jun 13 02:36:01 2003


Hi Ito,

thanks for the patch!

--- Ito Kazumitsu <ito.kazumitsu@hitachi-cable.co.jp> wrote:
> This is what I did to make kaffe 1.1.0 work with Linux 2.0.38.
> 
> 1.  tar xzvf kaffe-1.1.0.tar.gz
>     cd kaffe-1.1.0
> 
> 2.  Copy from CVS files added or modified since the release of kaffe 1.1.0.
> 
> 3.  Modify some programs (patch attached below).
> 
>     libraries/clib/net/InetAddressImpl.c.orig
>     libraries/clib/net/NetworkInterfaceImpl.c.orig
>     libraries/clib/net/PlainSocketImpl.c.orig
>     include/getaddrinfo.h.orig
>     include/dummyin6.h.orig
> 
> 4.  ./configure
> 
> 5.  make 'CFLAGS=-Din_port_t=int -g -O2 -Wall -Wstrict-prototypes'

something seems to be going wrong with the in_port_t detection code. On your
system, when you 

grep in_port_t /usr/include/*/* 

is there a definition somewhere? And what does the configure.log say about the
in_port_t test?

> 6.  make check

Thanks for the patch, looks like we're getting closer and closer ;) I have a
couple of comments.

> --- include/getaddrinfo.h.orig	Fri Jun 13 08:49:18 2003
> +++ include/getaddrinfo.h	Fri Jun 13 11:30:51 2003
> @@ -137,6 +137,7 @@
>  #define freeaddrinfo my_freeaddrinfo
>  #define getaddrinfo my_getaddrinfo
>  #define getnameinfo my_getnameinfo
> +#define FAKE_INET6 1
>  #endif

How does the compilation break if you don't define FAKE_INET6 ? 

I'd prefer to #ifdef portions of the code based on presence of specific
features, instead of on the presence of its whole IPv6 implementation, if any
possible :)

>  /********************************************************************/
> --- include/dummyin6.h.orig	Fri Jun 13 08:48:31 2003
> +++ include/dummyin6.h	Fri Jun 13 11:48:15 2003
> @@ -72,7 +72,9 @@
>  struct sockaddr_in6 {
>      sa_family_t sin6_family;
>      in_port_t sin6_port;
> +    int sin6_flowinfo;               /* fake */
>      struct in6_addr sin6_addr;
> +    int sin6_scope_id;               /* fake */
>  };
>  #endif

Looks good, please check the dummyin.h patch in, and send it to the getaddrinfo
maintainer for inclusion in the next version. I don't think the 'fake'comments
are really necessary, since it's all fake IPv6 support anyway ;)

I've googled around a bit, and there are apparently some linux versions that
don't have sin6_flowinfo and sin6_scope_id in their struct sockaddr_in6 [1].
Beside adding them in dummyin6.h, I think we should #ifdef them, too, to avoid
compilation problems on such systems. I'll check in a patch tonight that does
that.

cheers,
dalibor topic

[1] http://www.wcug.wwu.edu/lists/netdev/199912/msg00096.html

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com