NetBeans Under OpenJDK 7 On OS X - Dual Display

Max (Weijun) Wang Weijun.Wang at Sun.COM
Wed Jan 21 22:20:13 PST 2009


The original #ifdef block has not taken care of timeout == -1. The  
following codes work:

     if (timeout > 0) {
         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 {
         INTERRUPTIBLE_NORESTART(::select(fd+1, &fdset, NULL, NULL,  
NULL), res, os::Bsd::clear_interrupted);
     }

Max

On Jan 22, 2009, at 1:52 PM, Max (Weijun) Wang wrote:

> Sorry, my previous analysis is wrong. The problem seems to be in
> NET_timeout.
>
> I noticed some lines in hotspot/src/os/bsd/vm/hpi_bsd.hpp
> http://hg.openjdk.java.net/bsd-port/bsd-port/hotspot/file/4244db6cd9a9/src/os/bsd/vm/hpi_bsd.hpp
>
> #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
>
> In fact, if I remove the #if part and revert to the #else block.
> Everything works again. I'm using OS X 10.5.6 on a 32bit Core Duo
> MacBook.
>
> Thanks
> Max
>
> On Jan 22, 2009, at 12:40 PM, Max (Weijun) Wang wrote:
>
>> It seems even the simplest networking code fails.
>>
>> $ cat ~/tmp/A.java
>> class  A {
>>  public static void main(String[] args) throws Exception {
>>    new java.net.ServerSocket(10000).accept();
>>  }
>> }
>>
>> $ java A
>> Exception in thread "main" java.net.SocketException: Invalid argument
>> 	at java.net.PlainSocketImpl.socketAccept(Native Method)
>> 	at
>> java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:
>> 364)
>> 	at java.net.ServerSocket.implAccept(ServerSocket.java:513)
>> 	at java.net.ServerSocket.accept(ServerSocket.java:481)
>> 	at A.main(A.java:3)
>>
>> Don't know why. The problem comes from C function NET_Accept, which  
>> is
>> mentioned in these files:
>>
>>   jdk/make/java/net/FILES_c.gmk
>>      Include bsd_close.c when OS_VENDOR is FreeBSD
>>   jdk/src/solaris/native/java/net/bsd_close.c
>>      Defines a version of NET_Accept
>>   jdk/src/solaris/native/java/net/net_util_md.h
>>      Declares NET_Accept, using impl of bsd_close.c or JVM_Accept
>> depending on defined(__FreeBSD__)
>>
>> I'm not familiar with BSD C coding. Anyway on Mac OS_VENDOR is Apple.
>>
>> Max
>>
>> On Dec 20, 2008, at 8:26 AM, Michael Franz wrote:
>>
>>> Hi,
>>>
>>> I am running NetBeans on OS X using OpenJDK 7.  This uses the X11
>>> implementation as there is no native Cocoa/Carbon Swing
>>> implementation.  There are a few quirks that I would like to
>>> mention, maybe someone can indicate what part of the code these
>>> issue are in.
>>>
>>> 1.  Menus - the cursor is sometimes 1 line item below what is
>>> highlighted
>>> 2.  Dual display - opening  new dialogs are centered between the
>>> displays (not the current display netbeans is in).
>>> 3. The log file has many of these exceptions:
>>> java.net.SocketException: Invalid argument
>>>       at java.net.PlainSocketImpl.socketAccept(Native Method)
>>>       at
>>> java 
>>> .net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:
>>> 364)
>>>       at java.net.ServerSocket.implAccept(ServerSocket.java:513)
>>>       at java.net.ServerSocket.accept(ServerSocket.java:481)
>>>       at org.netbeans.CLIHandler$Server.run(CLIHandler.java:1010)
>>>
>>>
>>> Michael
>>>
>>
>>
>
>




More information about the bsd-port-dev mailing list