Kaffe: Getting FTP to work, The alpha out of mem problem, a HP port

Bernie Solomon bernard at UG.EDS.COM
Wed Feb 26 06:00:26 PST 1997


I've just started using kaffe and was trying to get ftp to work and have
discovered a problem in socket binding which causes it to fail. I though
people might like my patch:

diff
kaffe-0.8.1/packages/tjwassoc.demon.co.uk/APInet/lib/java.net/PlainSocketImpl.c
orig-kaffe-0.8.1/packages/tjwassoc.demon.co.uk/APInet/lib/java.net/PlainSocketImpl.c
114,124d113
< 
<         if (lport == 0) {
<                 size_t alen = sizeof(addr);
< 
<                 r = getsockname(fd, (struct sockaddr*)&addr, &alen);
<                 if (r < 0) {
<                         SignalError(NULL, "java.io.IOException",
SYS_ERROR);
<                 }
<                 lport = ntohs(addr.sin_port);
<         }
< 

I also reproduced the report Alpha out of memory problem and found a fix
for that:

sdlhpp5% diff
kaffe-0.8.1/packages/tjwassoc.demon.co.uk/APIcore/lib/java.lang/Runtime.c
orig-kaffe-0.8.1/packages/tjwassoc.demon.co.uk/APIcore/lib/java.lang/Runtime.c
109,110c109,110
<       arglen = (args ? obj_length(args) : 0);
<       envlen = (envs ? obj_length(envs) : 0);
---
>       arglen = (args ? obj_length(args) : -1);
>       envlen = (envs ? obj_length(envs) : -1);

The difference in behaviour on different platforms is due to different
malloc's as malloc(0) is allowed to return NULL but some implementations
always allocate at least one byte. This fools the out of memory test. Of
course this shouldn't have been allocating zero in the first place (now
I suspect envs shouldn't really be NULL anyway but that's a different
matter).

And I've produced an interpreter version that seems to work (so far) on
HP700 HPUX 10.20 in case anyone is interested.
-- 
Bernie Solomon (bernard at edsug.com or Bernard.Solomon at acm.org)
Unigraphics Architecture, EDS-Unigraphics, Cambridge, UK


More information about the kaffe mailing list