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:

<         if (lport == 0) {
<                 size_t alen = sizeof(addr);
<                 r = getsockname(fd, (struct sockaddr*)&addr, &alen);
<                 if (r < 0) {
<                         SignalError(NULL, "java.io.IOException",
<                 }
<                 lport = ntohs(addr.sin_port);
<         }

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

sdlhpp5% diff
<       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

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