NetBeans Under OpenJDK 7 On OS X - Dual Display

Max (Weijun) Wang Weijun.Wang at Sun.COM
Thu Jan 22 16:20:18 PST 2009


Michael

The findings in the comments are almost identical to mine: Both the  
#else block (using poll) and #ifdef block (after fixing -1 timeout)  
work for me. I also don't understand why the #ifdef block was added  
from the beginning. That change was made by Landon at http://hg.bikemonkey.org/javasrc_1_6_jrl_darwin/rev/2dee67c0e1db 
.

My Macbook is a 32 bit Core Duo running 10.5.6. Perhaps poll does not  
work on other platforms? Say, 10.5.0, or 64 bit Core 2 Duo?

Also, [1] shows that bsd-port is to support all of FreeBSD, OpenBSD,  
NetBSD and MacOS X. We need to form a consortium to cover them as many  
as possible.

Thanks
Max

[1] http://mail.openjdk.java.net/pipermail/porters-dev/2008-July/000170.html

On Jan 23, 2009, at 8:03 AM, Michael Franz wrote:

> Max,
>
> I found the same things that you did.  I have not had time to  
> investigate (properly) whether the comments are valid or not.  So,  
> the change has not been committed.  If you have the time to test we  
> could get these changes into the repo.
>
> Michael
>
> On Thu, Jan 22, 2009 at 7:18 AM, Max (Weijun) Wang <Weijun.Wang at sun.com 
> > wrote:
> Hi Michael
>
> Oh, I didn't know you've already solved it. I only notice this  
> thread because JSN colleague Brad's name shows up somewhere.
>
> Max
>
>
> On Jan 22, 2009, at 7:59 PM, Michael Franz wrote:
>
> Max,
>
> Did you see this thread? http://mail.openjdk.java.net/pipermail/bsd-port-dev/2008-December/000229.html
>
> Michael
>
> On Thu, Jan 22, 2009 at 1:20 AM, Max (Weijun) Wang <Weijun.Wang at sun.com 
> > wrote:
> 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