Native Socket Error On OS X (BSDs)

Michael Franz mvfranz at gmail.com
Sun Dec 21 18:16:41 PST 2008


Hi,

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?

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).

#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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/bsd-port-dev/attachments/20081221/8920ad09/attachment.html 


More information about the bsd-port-dev mailing list