Native Socket Error On OS X (BSDs)

Greg Lewis glewis at eyesbeyond.com
Mon Dec 22 06:29:17 PST 2008


G'day Michael,

On Sun, Dec 21, 2008 at 09:16:41PM -0500, Michael Franz wrote:
> I have been investigating this more and been trying to figure out where
> NET_Timeout is defined on OS X.  It is being called in PlanSocketImpl.c.
> There are two definitions that I have found, one for linux and one for bsd.
> A third uses JVM_Timeout.  The bsd version is specific to FreeBSD.  Are
> there known issues with JVM_Timeout?  Why does Linux and FreeBSD need
> definitions that are different from the one in Hotspot?

They look very similar don't they.  I wonder if the HotSpot version is
actually exposed for the JDK code to use?

> jdk/src/solaris/native/java/net/bsd_close.c
> jdk/src/solaris/native/java/net/linux_close.c
> hotspot/src/os/bsd/vm/hpi_bsd.hpp
> 
> I changed the inline int hpi::timeout(int fd, long timeout) method to not
> use the Apple specific code and I think the problem is fixed (at least for
> me).

So just removing the __APPLE__ code below fixes it for you?  I can commit
that change for you.

> #ifdef __APPLE__
>     // XXXDARWIN: poll() appears non-interruptable on Leopard:
> Thread.interrupt() failed to
>     // cause interrupt. Does poll work at all on Tiger? Needs investigation.
>     fd_set fdset;
>     struct timeval seltv;
> 
>     FD_ZERO(&fdset);
>     FD_SET(fd, &fdset);
> 
>     seltv.tv_sec = timeout / 1000;
>     seltv.tv_usec = (timeout % 1000) * 1000;
> 
>     INTERRUPTIBLE_NORESTART(::select(fd+1, &fdset, NULL, NULL, &seltv), res,
> os::Bsd::clear_interrupted);
> #else
>     struct pollfd pfd;
> 
>     pfd.fd = fd;
>     pfd.events = POLLIN | POLLERR;
> 
>     INTERRUPTIBLE_NORESTART(::poll(&pfd, 1, timeout), res,
> os::Bsd::clear_interrupted);
> #endif
> 
> Michael

> 


-- 
Greg Lewis                          Email   : glewis at eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis at FreeBSD.org



More information about the bsd-port-dev mailing list