Mercurial > hg > release > icedtea7-2.2
changeset 1573:f42c98fdd7f4
Complete sun.nio.ch fixes.
2009-01-19 Andrew John Hughes <gnu_andrew@member.fsf.org>
* generated/sun/nio/ch/SocketOptionRegistry.java:
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java:
Added (1.7 extensions).
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions: Fix package.
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java:
Added (1.7 extensions).
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java,
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java:
Added to provide access to package-private NetworkInterface.getIndex().
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java,
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java,
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java:
Fixed imports.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java: Added.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java: Fixed imports.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java: Added.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java,
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java,
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java: Fixed imports.
* overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c,
* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java:
Fixed imports.
* overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
* patches/icedtea-nio2.patch: Add hook for SharedSecrets to NetworkInterface, extend
sun.nio.ch.{Net,DatagramChannelImpl,SelectorProviderImpl} to handle 1.7 extensions.
line wrap: on
line diff
--- a/ChangeLog Thu Jan 15 02:32:49 2009 +0000 +++ b/ChangeLog Mon Jan 19 14:23:34 2009 +0000 @@ -1,3 +1,32 @@ +2009-01-19 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * generated/sun/nio/ch/SocketOptionRegistry.java: + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java: + Added (1.7 extensions). + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions: Fix package. + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java: + Added (1.7 extensions). + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java, + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java: + Added to provide access to package-private NetworkInterface.getIndex(). + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java, + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java, + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java: + Fixed imports. + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java: Added. + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java: Fixed imports. + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java: Added. + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java, + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java, + * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java: Fixed imports. + * overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c, + * overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java: Added. + * overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java: + Fixed imports. + * overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java: Added. + * patches/icedtea-nio2.patch: Add hook for SharedSecrets to NetworkInterface, extend + sun.nio.ch.{Net,DatagramChannelImpl,SelectorProviderImpl} to handle 1.7 extensions. + 2009-01-14 Andrew John Hughes <gnu_andrew@member.fsf.org> * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/generated/sun/nio/ch/SocketOptionRegistry.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +// AUTOMATICALLY GENERATED FILE - DO NOT EDIT +package sun.nio.ch; +import java.util.Map; +import java.util.HashMap; +import org.classpath.icedtea.java.net.ProtocolFamily; +import org.classpath.icedtea.java.net.StandardProtocolFamily; +import org.classpath.icedtea.java.net.SocketOption; +import org.classpath.icedtea.java.net.StandardSocketOption; +class SocketOptionRegistry { + private SocketOptionRegistry() { } + private static class RegistryKey { + private final SocketOption<?> name; + private final ProtocolFamily family; + RegistryKey(SocketOption<?> name, ProtocolFamily family) { + this.name = name; + this.family = family; + } + public int hashCode() { + return name.hashCode() + family.hashCode(); + } + public boolean equals(Object ob) { + if (ob == null) return false; + if (!(ob instanceof RegistryKey)) return false; + RegistryKey other = (RegistryKey)ob; + if (this.name != other.name) return false; + if (this.family != other.family) return false; + return true; + } + } + private static class LazyInitialization { + static final Map<RegistryKey,OptionKey> options = options(); + private static Map<RegistryKey,OptionKey> options() { + Map<RegistryKey,OptionKey> map = + new HashMap<RegistryKey,OptionKey>(); + map.put(new RegistryKey(StandardSocketOption.SO_BROADCAST, Net.UNSPEC), new OptionKey(1, 6)); + map.put(new RegistryKey(StandardSocketOption.SO_KEEPALIVE, Net.UNSPEC), new OptionKey(1, 9)); + map.put(new RegistryKey(StandardSocketOption.SO_LINGER, Net.UNSPEC), new OptionKey(1, 13)); + map.put(new RegistryKey(StandardSocketOption.SO_SNDBUF, Net.UNSPEC), new OptionKey(1, 7)); + map.put(new RegistryKey(StandardSocketOption.SO_RCVBUF, Net.UNSPEC), new OptionKey(1, 8)); + map.put(new RegistryKey(StandardSocketOption.SO_REUSEADDR, Net.UNSPEC), new OptionKey(1, 2)); + map.put(new RegistryKey(StandardSocketOption.TCP_NODELAY, Net.UNSPEC), new OptionKey(6, 1)); + map.put(new RegistryKey(StandardSocketOption.IP_TOS, StandardProtocolFamily.INET), new OptionKey(0, 1)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_IF, StandardProtocolFamily.INET), new OptionKey(0, 32)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_TTL, StandardProtocolFamily.INET), new OptionKey(0, 33)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_LOOP, StandardProtocolFamily.INET), new OptionKey(0, 34)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_IF, StandardProtocolFamily.INET6), new OptionKey(41, 17)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_TTL, StandardProtocolFamily.INET6), new OptionKey(41, 18)); + map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_LOOP, StandardProtocolFamily.INET6), new OptionKey(41, 19)); + map.put(new RegistryKey(ExtendedSocketOption.SO_OOBINLINE, Net.UNSPEC), new OptionKey(1, 10)); + return map; + } + } + public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { + RegistryKey key = new RegistryKey(name, family); + return LazyInitialization.options.get(key); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,223 @@ +/* + * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package org.classpath.icedtea.java.nio.channels; + +import java.io.IOException; +import java.net.DatagramSocket; +import java.net.SocketAddress; +import java.nio.ByteBuffer; + +import org.classpath.icedtea.java.net.ProtocolFamily; +import org.classpath.icedtea.java.net.SocketOption; + +import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider; + +/** + * A selectable channel for datagram-oriented sockets. + * + * <p> {@note revised} A datagram channel is created by invoking one of the {@link #open open} methods + * of this class. It is not possible to create a channel for an arbitrary, + * pre-existing datagram socket. A newly-created datagram channel is open but not + * connected. A datagram channel need not be connected in order for the {@link #send + * send} and {@link #receive receive} methods to be used. A datagram channel may be + * connected, by invoking its {@link #connect connect} method, in order to + * avoid the overhead of the security checks are otherwise performed as part of + * every send and receive operation. A datagram channel must be connected in + * order to use the {@link #read(java.nio.ByteBuffer) read} and {@link + * #write(java.nio.ByteBuffer) write} methods, since those methods do not + * accept or return socket addresses. + * + * <p> Once connected, a datagram channel remains connected until it is + * disconnected or closed. Whether or not a datagram channel is connected may + * be determined by invoking its {@link #isConnected isConnected} method. + * + * <p> Socket options are configured using the {@link #setOption(SocketOption,Object) + * setOption} method. A datagram channel to an Internet Protocol socket supports + * the following options: + * <blockquote> + * <table border> + * <tr> + * <th>Option Name</th> + * <th>Description</th> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td> + * <td> The size of the socket send buffer </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td> + * <td> The size of the socket receive buffer </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td> + * <td> Re-use address </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} </td> + * <td> Allow transmission of broadcast datagrams </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#IP_TOS IP_TOS} </td> + * <td> The Type of Service (ToS) octet in the Internet Protocol (IP) header </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#IP_MULTICAST_IF IP_MULTICAST_IF} </td> + * <td> The network interface for Internet Protocol (IP) multicast datagrams </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#IP_MULTICAST_TTL + * IP_MULTICAST_TTL} </td> + * <td> The <em>time-to-live</em> for Internet Protocol (IP) multicast + * datagrams </td> + * </tr> + * <tr> + * <td> {@link java.net.StandardSocketOption#IP_MULTICAST_LOOP + * IP_MULTICAST_LOOP} </td> + * <td> Loopback for Internet Protocol (IP) multicast datagrams </td> + * </tr> + * </table> + * </blockquote> + * Additional (implementation specific) options may also be supported. + * + * <p> Datagram channels are safe for use by multiple concurrent threads. They + * support concurrent reading and writing, though at most one thread may be + * reading and at most one thread may be writing at any given time. </p> + * + * @author Mark Reinhold + * @author JSR-51 Expert Group + * @since 1.4 + * @updated 1.7 + */ + +public abstract class DatagramChannel + extends java.nio.channels.DatagramChannel + implements MulticastChannel +{ + + /** + * Initializes a new instance of this class. + */ + protected DatagramChannel(SelectorProvider provider) { + super(provider); + } + + /** + * Opens a datagram channel. + * + * <p> The new channel is created by invoking the {@link + * java.nio.channels.spi.SelectorProvider#openDatagramChannel() + * openDatagramChannel} method of the system-wide default {@link + * java.nio.channels.spi.SelectorProvider} object. The channel will not be + * connected. </p> + * + * @return A new datagram channel + * + * @throws IOException + * If an I/O error occurs + */ + public static DatagramChannel open() throws IOException { + return SelectorProvider.provider().openDatagramChannel(); + } + + /** + * Opens a datagram channel. + * + * <p> The {@code family} parameter is used to specify the {@link + * ProtocolFamily}. If the datagram channel is to be used for IP multicasing + * then this should correspond to the address type of the multicast groups + * that this channel will join. + * + * <p> The new channel is created by invoking the {@link + * java.nio.channels.spi.SelectorProvider#openDatagramChannel(ProtocolFamily) + * openDatagramChannel} method of the system-wide default {@link + * java.nio.channels.spi.SelectorProvider} object. The channel will not be + * connected. + * + * @param family + * The protocol family + * + * @return A new datagram channel + * + * @throws UnsupportedOperationException + * If the specified protocol family is not supported. For example, + * suppose the parameter is specified as {@link + * java.net.StandardProtocolFamily#INET6 StandardProtocolFamily.INET6} + * but IPv6 is not enabled on the platform. + * @throws IOException + * If an I/O error occurs + * + * @since 1.7 + */ + public static DatagramChannel open(ProtocolFamily family) throws IOException { + return SelectorProvider.provider().openDatagramChannel(family); + } + + + // -- Socket-specific operations -- + + /** + * @throws AlreadyBoundException {@inheritDoc} + * @throws UnsupportedAddressTypeException {@inheritDoc} + * @throws ClosedChannelException {@inheritDoc} + * @throws IOException {@inheritDoc} + * @throws SecurityException + * If a security manager has been installed and its {@link + * SecurityManager#checkListen checkListen} method denies the + * operation + * + * @since 1.7 + */ + public abstract DatagramChannel bind(SocketAddress local) + throws IOException; + + /** + * @throws IllegalArgumentException {@inheritDoc} + * @throws ClosedChannelException {@inheritDoc} + * @throws IOException {@inheritDoc} + * + * @since 1.7 + */ + public abstract <T> DatagramChannel setOption(SocketOption<T> name, T value) + throws IOException; + + /** + * {@note new} + * Returns the remote address to which this channel's socket is connected. + * + * @return The remote address; {@code null} if the channel's socket is not + * connected + * + * @throws ClosedChannelException + * If the channel is closed + * @throws IOException + * If an I/O error occurs + * + * @since 1.7 + */ + public abstract SocketAddress getRemoteAddress() throws IOException; + +}
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions Mon Jan 19 14:23:34 2009 +0000 @@ -25,7 +25,7 @@ # Generated exception classes for java.nio.channels -PACKAGE=java.nio.channels +PACKAGE=org.classpath.icedtea.java.nio.channels # This year should only change if the generated source is modified. COPYRIGHT_YEARS=2000-2007 SINCE=1.7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,199 @@ +/* + * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package org.classpath.icedtea.java.nio.channels.spi; + +import java.io.IOException; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import java.util.Iterator; +import java.util.ServiceLoader; +import java.util.ServiceConfigurationError; + +import org.classpath.icedtea.java.net.ProtocolFamily; + +import org.classpath.icedtea.java.nio.channels.DatagramChannel; + +/** + * Service-provider class for selectors and selectable channels. + * + * <p> A selector provider is a concrete subclass of this class that has a + * zero-argument constructor and implements the abstract methods specified + * below. A given invocation of the Java virtual machine maintains a single + * system-wide default provider instance, which is returned by the {@link + * #provider() provider} method. The first invocation of that method will locate + * the default provider as specified below. + * + * <p> The system-wide default provider is used by the static <tt>open</tt> + * methods of the {@link java.nio.channels.DatagramChannel#open + * DatagramChannel}, {@link java.nio.channels.Pipe#open Pipe}, {@link + * java.nio.channels.Selector#open Selector}, {@link + * java.nio.channels.ServerSocketChannel#open ServerSocketChannel}, and {@link + * java.nio.channels.SocketChannel#open SocketChannel} classes. It is also + * used by the {@link java.lang.System#inheritedChannel System.inheritedChannel()} + * method. A program may make use of a provider other than the default provider + * by instantiating that provider and then directly invoking the <tt>open</tt> + * methods defined in this class. + * + * <p> All of the methods in this class are safe for use by multiple concurrent + * threads. </p> + * + * + * @author Mark Reinhold + * @author JSR-51 Expert Group + * @since 1.4 + */ + +public abstract class SelectorProvider + extends java.nio.channels.spi.SelectorProvider { + + private static final Object lock = new Object(); + private static SelectorProvider provider = null; + + /** + * Opens a datagram channel. </p> + * + * @return The new channel + */ + public abstract DatagramChannel openDatagramChannel() + throws IOException; + + /** + * {@note new} + * Opens a datagram channel. + * + * @param family + * The protocol family + * + * @return A new datagram channel + * + * @throws UnsupportedOperationException + * If the specified protocol family is not supported + * @throws IOException + * If an I/O error occurs + * + * @since 1.7 + */ + public abstract DatagramChannel openDatagramChannel(ProtocolFamily family) + throws IOException; + + /** + * Returns the system-wide default selector provider for this invocation of + * the Java virtual machine. + * + * <p> The first invocation of this method locates the default provider + * object as follows: </p> + * + * <ol> + * + * <li><p> If the system property + * <tt>java.nio.channels.spi.SelectorProvider</tt> is defined then it is + * taken to be the fully-qualified name of a concrete provider class. + * The class is loaded and instantiated; if this process fails then an + * unspecified error is thrown. </p></li> + * + * <li><p> If a provider class has been installed in a jar file that is + * visible to the system class loader, and that jar file contains a + * provider-configuration file named + * <tt>java.nio.channels.spi.SelectorProvider</tt> in the resource + * directory <tt>META-INF/services</tt>, then the first class name + * specified in that file is taken. The class is loaded and + * instantiated; if this process fails then an unspecified error is + * thrown. </p></li> + * + * <li><p> Finally, if no provider has been specified by any of the above + * means then the system-default provider class is instantiated and the + * result is returned. </p></li> + * + * </ol> + * + * <p> Subsequent invocations of this method return the provider that was + * returned by the first invocation. </p> + * + * @return The system-wide default selector provider + */ + public static SelectorProvider provider() { + synchronized (lock) { + if (provider != null) + return provider; + return AccessController + .doPrivileged(new PrivilegedAction<SelectorProvider>() { + public SelectorProvider run() { + if (loadProviderFromProperty()) + return provider; + if (loadProviderAsService()) + return provider; + provider = sun.nio.ch.DefaultSelectorProvider.create(); + return provider; + } + }); + } + } + + private static boolean loadProviderFromProperty() { + String cn = System.getProperty("org.classpath.icedtea.java.nio.channels.spi.SelectorProvider"); + if (cn == null) + return false; + try { + Class<?> c = Class.forName(cn, true, + ClassLoader.getSystemClassLoader()); + provider = (SelectorProvider)c.newInstance(); + return true; + } catch (ClassNotFoundException x) { + throw new ServiceConfigurationError(null, x); + } catch (IllegalAccessException x) { + throw new ServiceConfigurationError(null, x); + } catch (InstantiationException x) { + throw new ServiceConfigurationError(null, x); + } catch (SecurityException x) { + throw new ServiceConfigurationError(null, x); + } + } + + private static boolean loadProviderAsService() { + + ServiceLoader<SelectorProvider> sl = + ServiceLoader.load(SelectorProvider.class, + ClassLoader.getSystemClassLoader()); + Iterator<SelectorProvider> i = sl.iterator(); + for (;;) { + try { + if (!i.hasNext()) + return false; + provider = i.next(); + return true; + } catch (ServiceConfigurationError sce) { + if (sce.getCause() instanceof SecurityException) { + // Ignore the security exception, try the next provider + continue; + } + throw sce; + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,45 @@ +/* JavaNetGetIndex.java + Copyright (C) 2009 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package org.classpath.icedtea.misc; + +import java.net.NetworkInterface; + +public interface JavaNetGetIndexAccess +{ + int getIndex(NetworkInterface nf); +}
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java Mon Jan 19 14:23:34 2009 +0000 @@ -54,6 +54,7 @@ private static final Unsafe unsafe = Unsafe.getUnsafe(); private static JavaIODeleteOnExitAccess javaIODeleteOnExitAccess; private static JavaUtilConcurrentThreadPoolExecutorAccess javaUtilConcurrentThreadPoolExecutorAccess; + private static JavaNetGetIndexAccess javaNetGetIndexAccess; public static void setJavaIODeleteOnExitAccess(JavaIODeleteOnExitAccess jida) { @@ -83,4 +84,19 @@ return javaUtilConcurrentThreadPoolExecutorAccess; } + public static void setJavaNetGetIndexAccess(JavaNetGetIndexAccess jngia) + { + javaNetGetIndexAccess = jngia; + } + + public static JavaNetGetIndexAccess getJavaNetGetIndexAccess() + { + if (javaNetGetIndexAccess == null) + { + unsafe.ensureClassInitialized(java.net.NetworkInterface.class); + } + return javaNetGetIndexAccess; + } + + }
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java Mon Jan 19 14:23:34 2009 +0000 @@ -27,8 +27,6 @@ import java.nio.channels.*; import java.net.SocketAddress; -import java.net.SocketOption; -import java.net.StandardSocketOption; import java.net.InetSocketAddress; import java.io.FileDescriptor; import java.io.IOException; @@ -38,6 +36,9 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.classpath.icedtea.java.net.SocketOption; +import org.classpath.icedtea.java.net.StandardSocketOption; + import org.classpath.icedtea.java.nio.channels.AsynchronousServerSocketChannel; /**
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java Mon Jan 19 14:23:34 2009 +0000 @@ -27,8 +27,6 @@ import java.nio.ByteBuffer; import java.nio.channels.*; -import java.net.SocketOption; -import java.net.StandardSocketOption; import java.net.SocketAddress; import java.net.InetSocketAddress; import java.io.IOException; @@ -39,7 +37,13 @@ import java.util.concurrent.*; import java.util.concurrent.locks.*; +import org.classpath.icedtea.java.net.SocketOption; +import org.classpath.icedtea.java.net.StandardSocketOption; + import org.classpath.icedtea.java.nio.channels.AsynchronousSocketChannel; +import org.classpath.icedtea.java.nio.channels.CompletionHandler; +import org.classpath.icedtea.java.nio.channels.ReadPendingException; +import org.classpath.icedtea.java.nio.channels.WritePendingException; /** * Base implementation of AsynchronousSocketChannel
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java Mon Jan 19 14:23:34 2009 +0000 @@ -25,11 +25,12 @@ package sun.nio.ch; -import java.nio.channels.AsynchronousChannel; import java.util.concurrent.TimeUnit; import java.util.concurrent.ExecutionException; import java.io.IOException; +import org.classpath.icedtea.java.nio.channels.AsynchronousChannel; + /** * A Future representing the result of an I/O operation that has already * completed.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.nio.ch; + +import org.classpath.icedtea.java.net.SocketOption; + +/** + * Defines socket options that are supported by the implementation + * but not defined in StandardSocketOption. + */ + +class ExtendedSocketOption { + private ExtendedSocketOption() { } + + static final SocketOption<Boolean> SO_OOBINLINE = + new SocketOption<Boolean>() { + public String name() { return "SO_OOBINLINE"; } + public Class<Boolean> type() { return Boolean.class; } + public String toString() { return name(); } + }; +}
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java Mon Jan 19 14:23:34 2009 +0000 @@ -25,11 +25,14 @@ package sun.nio.ch; -import java.nio.channels.*; import java.util.concurrent.*; import java.security.AccessController; import sun.security.action.GetPropertyAction; +import org.classpath.icedtea.java.nio.channels.AsynchronousChannel; +import org.classpath.icedtea.java.nio.channels.CompletionHandler; +import org.classpath.icedtea.java.nio.channels.ShutdownChannelGroupException; + /** * Defines static methods to invoke a completion handler or arbitrary task. */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.nio.ch; + +/** + * Represents the level/name of a socket option + */ + +class OptionKey { + private int level; + private int name; + + OptionKey(int level, int name) { + this.level = level; + this.name = name; + } + + int level() { + return level; + } + + int name() { + return name; + } +}
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java Mon Jan 19 14:23:34 2009 +0000 @@ -25,10 +25,12 @@ package sun.nio.ch; -import java.nio.channels.*; import java.util.concurrent.*; import java.io.IOException; +import org.classpath.icedtea.java.nio.channels.AsynchronousChannel; +import org.classpath.icedtea.java.nio.channels.CompletionHandler; + /** * A Future for a pending I/O operation. A PendingFuture allows for the * attachment of an additional arbitrary context object and a timer task.
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java Mon Jan 19 14:23:34 2009 +0000 @@ -26,7 +26,11 @@ package sun.nio.ch; import java.nio.ByteBuffer; -import java.nio.channels.*; + +import java.nio.channels.AsynchronousCloseException; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.NotYetConnectedException; + import java.net.*; import java.io.IOException; import java.util.*; @@ -36,8 +40,16 @@ import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import org.classpath.icedtea.java.net.ProtocolFamily; +import org.classpath.icedtea.java.net.SocketOption; + import org.classpath.icedtea.java.nio.channels.AsynchronousDatagramChannel; +import org.classpath.icedtea.java.nio.channels.CompletionHandler; +import org.classpath.icedtea.java.nio.channels.DatagramChannel; +import org.classpath.icedtea.java.nio.channels.InterruptedByTimeoutException; import org.classpath.icedtea.java.nio.channels.MembershipKey; +import org.classpath.icedtea.java.nio.channels.MulticastChannel; +import org.classpath.icedtea.java.nio.channels.ShutdownChannelGroupException; /** * A prototype implementation of AsynchronousDatagramChannel, used to aid
--- a/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java Mon Jan 19 14:23:34 2009 +0000 @@ -25,11 +25,12 @@ package sun.nio.ch; -import java.nio.channels.spi.AsynchronousChannelProvider.ThreadPoolType; import java.util.concurrent.*; import java.security.AccessController; import sun.security.action.GetPropertyAction; +import org.classpath.icedtea.java.nio.channels.spi.AsynchronousChannelProvider.ThreadPoolType; + /** * Defines static methods to create thread pools that are configured by * system properties or a Map of parameters (or a combination of both).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,129 @@ +/* + * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +#include <stdio.h> +#ifdef _WIN32 +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#endif + +/** + * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level + * socket options to the platform specific level and option. + */ + +static void out(char* s) { + printf("%s\n", s); +} + +static void emit(const char *name, char * family, int level, int optname) { + printf(" map.put(new RegistryKey(%s, %s),", name, family); + printf(" new OptionKey(%d, %d));\n", level, optname); +} + +static void emit_unspec(const char *name, int level, int optname) { + emit(name, "Net.UNSPEC", level, optname); +} + +static void emit_inet(const char *name, int level, int optname) { + emit(name, "StandardProtocolFamily.INET", level, optname); +} + +static void emit_inet6(const char *name, int level, int optname) { + emit(name, "StandardProtocolFamily.INET6", level, optname); +} + +int main(int argc, const char* argv[]) { + out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT "); + out("package sun.nio.ch; "); + out("import java.util.Map; "); + out("import java.util.HashMap; "); + out("import org.classpath.icedtea.java.net.ProtocolFamily; "); + out("import org.classpath.icedtea.java.net.StandardProtocolFamily; "); + out("import org.classpath.icedtea.java.net.SocketOption; "); + out("import org.classpath.icedtea.java.net.StandardSocketOption; "); + out("class SocketOptionRegistry { "); + out(" private SocketOptionRegistry() { } "); + out(" private static class RegistryKey { "); + out(" private final SocketOption<?> name; "); + out(" private final ProtocolFamily family; "); + out(" RegistryKey(SocketOption<?> name, ProtocolFamily family) { "); + out(" this.name = name; "); + out(" this.family = family; "); + out(" } "); + out(" public int hashCode() { "); + out(" return name.hashCode() + family.hashCode(); "); + out(" } "); + out(" public boolean equals(Object ob) { "); + out(" if (ob == null) return false; "); + out(" if (!(ob instanceof RegistryKey)) return false; "); + out(" RegistryKey other = (RegistryKey)ob; "); + out(" if (this.name != other.name) return false; "); + out(" if (this.family != other.family) return false; "); + out(" return true; "); + out(" } "); + out(" } "); + out(" private static class LazyInitialization { "); + out(" static final Map<RegistryKey,OptionKey> options = options(); "); + out(" private static Map<RegistryKey,OptionKey> options() { "); + out(" Map<RegistryKey,OptionKey> map = "); + out(" new HashMap<RegistryKey,OptionKey>(); "); + + emit_unspec("StandardSocketOption.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST); + emit_unspec("StandardSocketOption.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE); + emit_unspec("StandardSocketOption.SO_LINGER", SOL_SOCKET, SO_LINGER); + emit_unspec("StandardSocketOption.SO_SNDBUF", SOL_SOCKET, SO_SNDBUF); + emit_unspec("StandardSocketOption.SO_RCVBUF", SOL_SOCKET, SO_RCVBUF); + emit_unspec("StandardSocketOption.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR); + emit_unspec("StandardSocketOption.TCP_NODELAY", IPPROTO_TCP, TCP_NODELAY); + + emit_inet("StandardSocketOption.IP_TOS", IPPROTO_IP, IP_TOS); + emit_inet("StandardSocketOption.IP_MULTICAST_IF", IPPROTO_IP, IP_MULTICAST_IF); + emit_inet("StandardSocketOption.IP_MULTICAST_TTL", IPPROTO_IP, IP_MULTICAST_TTL); + emit_inet("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IP, IP_MULTICAST_LOOP); + +#ifdef AF_INET6 + emit_inet6("StandardSocketOption.IP_MULTICAST_IF", IPPROTO_IPV6, IPV6_MULTICAST_IF); + emit_inet6("StandardSocketOption.IP_MULTICAST_TTL", IPPROTO_IPV6, IPV6_MULTICAST_HOPS); + emit_inet6("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IPV6, IPV6_MULTICAST_LOOP); +#endif + + emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE); + + out(" return map; "); + out(" } "); + out(" } "); + out(" public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { "); + out(" RegistryKey key = new RegistryKey(name, family); "); + out(" return LazyInitialization.options.get(key); "); + out(" } "); + out("} "); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,76 @@ +/* + * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.nio.ch; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import sun.security.action.GetPropertyAction; + +import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider; + +/** + * Creates this platform's default SelectorProvider + */ + +public class DefaultSelectorProvider { + + /** + * Prevent instantiation. + */ + private DefaultSelectorProvider() { } + + /** + * Returns the default SelectorProvider. + */ + public static SelectorProvider create() { + String osname = AccessController.doPrivileged( + new GetPropertyAction("os.name")); + if ("SunOS".equals(osname)) { + return new sun.nio.ch.DevPollSelectorProvider(); + } + + // use EPollSelectorProvider for Linux kernels >= 2.6 + if ("Linux".equals(osname)) { + String osversion = AccessController.doPrivileged( + new GetPropertyAction("os.version")); + String[] vers = osversion.split("\\.", 0); + if (vers.length >= 2) { + try { + int major = Integer.parseInt(vers[0]); + int minor = Integer.parseInt(vers[1]); + if (major > 2 || (major == 2 && minor >= 6)) { + return new sun.nio.ch.EPollSelectorProvider(); + } + } catch (NumberFormatException x) { + // format not recognized + } + } + } + + return new sun.nio.ch.PollSelectorProvider(); + } + +}
--- a/overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java Thu Jan 15 02:32:49 2009 +0000 +++ b/overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java Mon Jan 19 14:23:34 2009 +0000 @@ -26,11 +26,12 @@ package sun.nio.ch; import java.nio.channels.*; -import java.nio.channels.spi.AsynchronousChannelProvider; import java.util.concurrent.ExecutorService; import java.net.ProtocolFamily; import java.io.IOException; +import org.classpath.icedtea.java.nio.channels.spi.AsynchronousChannelProvider; + public class SolarisAsynchronousChannelProvider extends AsynchronousChannelProvider {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java Mon Jan 19 14:23:34 2009 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.nio.ch; + +import java.nio.channels.spi.SelectorProvider; + + +/** + * Creates this platform's default SelectorProvider + */ + +public class DefaultSelectorProvider { + + /** + * Prevent instantiation. + */ + private DefaultSelectorProvider() { } + + /** + * Returns the default SelectorProvider. + */ + public static SelectorProvider create() { + return new sun.nio.ch.WindowsSelectorProvider(); + } + +}
--- a/patches/icedtea-nio2.patch Thu Jan 15 02:32:49 2009 +0000 +++ b/patches/icedtea-nio2.patch Mon Jan 19 14:23:34 2009 +0000 @@ -52,7 +52,7 @@ FILES_java = $(JAVA_JAVA_java) diff -Nru openjdk.orig/jdk/make/java/nio/FILES_java.gmk openjdk/jdk/make/java/nio/FILES_java.gmk --- openjdk.orig/jdk/make/java/nio/FILES_java.gmk 2009-01-10 03:21:38.000000000 +0000 -+++ openjdk/jdk/make/java/nio/FILES_java.gmk 2009-01-14 01:49:10.000000000 +0000 ++++ openjdk/jdk/make/java/nio/FILES_java.gmk 2009-01-16 19:47:40.000000000 +0000 @@ -75,7 +75,6 @@ sun/nio/ch/DefaultSelectorProvider.java \ sun/nio/ch/DirectBuffer.java \ @@ -61,7 +61,15 @@ sun/nio/ch/FileKey.java \ sun/nio/ch/Interruptible.java \ sun/nio/ch/IOUtil.java \ -@@ -144,7 +143,147 @@ +@@ -100,6 +99,7 @@ + sun/nio/ch/SocketAdaptor.java \ + sun/nio/ch/SocketChannelImpl.java \ + sun/nio/ch/SocketDispatcher.java \ ++ sun/nio/ch/SocketOptionRegistry.java \ + sun/nio/ch/SocketOpts.java \ + sun/nio/ch/SocketOptsImpl.java \ + sun/nio/ch/SourceChannelImpl.java \ +@@ -144,7 +144,150 @@ java/lang/StringCoding.java \ \ sun/misc/Cleaner.java \ @@ -81,6 +89,7 @@ + org/classpath/icedtea/java/nio/channels/AsynchronousSocketChannel.java \ + org/classpath/icedtea/java/nio/channels/Channels.java \ + org/classpath/icedtea/java/nio/channels/CompletionHandler.java \ ++ org/classpath/icedtea/java/nio/channels/DatagramChannel.java \ + org/classpath/icedtea/java/nio/channels/FileChannel.java \ + org/classpath/icedtea/java/nio/channels/FileLock.java \ + org/classpath/icedtea/java/nio/channels/MembershipKey.java \ @@ -88,6 +97,7 @@ + org/classpath/icedtea/java/nio/channels/NetworkChannel.java \ + org/classpath/icedtea/java/nio/channels/SeekableByteChannel.java \ + org/classpath/icedtea/java/nio/channels/spi/AsynchronousChannelProvider.java \ ++ org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java \ + org/classpath/icedtea/java/nio/file/AccessDeniedException.java \ + org/classpath/icedtea/java/nio/file/AccessMode.java \ + org/classpath/icedtea/java/nio/file/AtomicMoveNotSupportedException.java \ @@ -168,6 +178,7 @@ + org/classpath/icedtea/java/util/concurrent/ScheduledThreadPoolExecutor.java \ + \ + org/classpath/icedtea/misc/JavaUtilConcurrentThreadPoolExecutorAccess.java \ ++ org/classpath/icedtea/misc/JavaNetGetIndexAccess.java \ + \ + com/sun/nio/file/ExtendedCopyOption.java \ + com/sun/nio/file/ExtendedOpenOption.java \ @@ -210,7 +221,7 @@ # Generated coder classes # -@@ -263,7 +402,14 @@ +@@ -263,10 +406,20 @@ \ java/nio/charset/CharacterCodingException.java \ java/nio/charset/IllegalCharsetNameException.java \ @@ -226,9 +237,16 @@ FILES_gen_csp = sun/nio/cs/StandardCharsets.java +-FILES_gen = $(FILES_gen_coder) $(FILES_gen_buffer) $(FILES_gen_ex) $(FILES_gen_csp) ++FILES_gen_sor = sun/nio/ch/SocketOptionRegistry.java ++ ++FILES_gen = $(FILES_gen_coder) $(FILES_gen_buffer) $(FILES_gen_ex) $(FILES_gen_csp) \ ++ $(FILES_gen_sor) + + FILES_java = $(FILES_src) $(FILES_gen) diff -Nru openjdk.orig/jdk/make/java/nio/Makefile openjdk/jdk/make/java/nio/Makefile --- openjdk.orig/jdk/make/java/nio/Makefile 2009-01-10 03:22:13.000000000 +0000 -+++ openjdk/jdk/make/java/nio/Makefile 2009-01-11 00:42:22.000000000 +0000 ++++ openjdk/jdk/make/java/nio/Makefile 2009-01-15 16:35:28.000000000 +0000 @@ -40,6 +40,11 @@ SNIO_SRC = $(SHARE_SRC)/classes/sun/nio SNIO_GEN = $(GENSRCDIR)/sun/nio @@ -500,10 +518,35 @@ # # Generated charset-provider classes -@@ -643,4 +811,48 @@ +@@ -643,4 +811,73 @@ HASHER="$(BOOT_JAVA_CMD) -jar $(HASHER_JARFILE)" \ SH="$(SH)" $(SH) -e genCharsetProvider.sh $(SCS_SRC)/standard-charsets $(SCS_GEN) ++# ++# Generated channel implementation classes. ++# C source is compiled in TEMPDIR to avoid turds left by Windows compilers. ++# ++ ++GENSOR_SRC = $(SHARE_SRC)/native/sun/nio/ch/genSocketOptionRegistry.c ++ ++GENSOR_EXE = $(TEMPDIR)/genSocketOptionRegistry$(EXE_SUFFIX) ++ ++SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSOR_SRC) | \ ++ $(NAWK) '/^.*Copyright.*Sun/ { print $$3 }') ++ ++$(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC) ++ $(install-file) ++ ++$(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC) ++ $(prep-target) ++ ($(CD) $(TEMPDIR); $(CC) $(CPPFLAGS) $(LDDFLAGS) \ ++ -o genSocketOptionRegistry$(EXE_SUFFIX) $(GENSOR_SRC)) ++ ++$(SCH_GEN)/SocketOptionRegistry.java: $(GENSOR_EXE) ++ $(prep-target) ++ NAWK="$(NAWK)" SH="$(SH)" $(SH) -e addNotices.sh $(SOR_COPYRIGHT_YEARS) > $@ ++ $(GENSOR_EXE) >> $@ ++ +# +# Generated file system implementation classes (Unix only) +# @@ -762,6 +805,24 @@ } +diff -Nru openjdk.orig/jdk/src/share/classes/java/net/NetworkInterface.java openjdk/jdk/src/share/classes/java/net/NetworkInterface.java +--- openjdk.orig/jdk/src/share/classes/java/net/NetworkInterface.java 2009-01-16 04:07:15.000000000 +0000 ++++ openjdk/jdk/src/share/classes/java/net/NetworkInterface.java 2009-01-16 04:08:41.000000000 +0000 +@@ -529,4 +529,14 @@ + } + private static native void init(); + ++ // Set up JavaIODeleteOnExitAccess in SharedSecrets ++ // Added here as getIndex is package-private and SharedSecrets cannot easily access it. ++ static { ++ org.classpath.icedtea.misc.SharedSecrets.setJavaNetGetIndexAccess( ++ new org.classpath.icedtea.misc.JavaNetGetIndexAccess() { ++ public int getIndex(NetworkInterface nf) { return nf.getIndex(); } ++ } ++ ); ++ } ++ + } diff -Nru openjdk.orig/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java openjdk/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java --- openjdk.orig/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java 2009-01-13 23:54:13.000000000 +0000 +++ openjdk/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java 2009-01-15 01:21:36.000000000 +0000 @@ -789,6 +850,437 @@ + } + } +diff -Nru openjdk.orig/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java openjdk/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java +--- openjdk.orig/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java 2009-01-16 03:10:17.000000000 +0000 ++++ openjdk/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java 2009-01-19 13:34:41.000000000 +0000 +@@ -29,10 +29,27 @@ + import java.io.IOException; + import java.net.*; + import java.nio.ByteBuffer; +-import java.nio.channels.*; +-import java.nio.channels.spi.*; ++ ++import java.nio.channels.ClosedChannelException; ++import java.nio.channels.NotYetConnectedException; ++import java.nio.channels.SelectionKey; ++ ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.Set; ++ + import java.lang.ref.SoftReference; + ++import org.classpath.icedtea.java.net.ProtocolFamily; ++import org.classpath.icedtea.java.net.StandardProtocolFamily; ++import org.classpath.icedtea.java.net.SocketOption; ++import org.classpath.icedtea.java.net.StandardSocketOption; ++ ++import org.classpath.icedtea.java.nio.channels.DatagramChannel; ++ ++import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider; ++ ++import org.classpath.icedtea.misc.SharedSecrets; + + /** + * An implementation of DatagramChannels. +@@ -53,6 +70,9 @@ + // even after the value in the file descriptor object has been set to -1 + int fdVal; + ++ // The protocol family of the socket ++ private final ProtocolFamily family; ++ + // IDs of native threads doing reads and writes, for signalling + private volatile long readerThread = 0; + private volatile long writerThread = 0; +@@ -98,15 +118,40 @@ + throws IOException + { + super(sp); ++ this.family = Net.isIPv6Available() ? ++ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; + this.fd = Net.socket(false); + this.fdVal = IOUtil.fdVal(fd); + this.state = ST_UNCONNECTED; + } + ++ public DatagramChannelImpl(SelectorProvider sp, ProtocolFamily family) { ++ super(sp); ++ if ((family != StandardProtocolFamily.INET) && ++ (family != StandardProtocolFamily.INET6)) ++ { ++ if (family == null) ++ throw new NullPointerException("'family' is null"); ++ else ++ throw new UnsupportedOperationException("Protocol family not supported"); ++ } ++ if (family == StandardProtocolFamily.INET6) { ++ if (!Net.isIPv6Available()) { ++ throw new UnsupportedOperationException("IPv6 not available"); ++ } ++ } ++ this.family = family; ++ this.fd = Net.socket(family, false); ++ this.fdVal = IOUtil.fdVal(fd); ++ this.state = ST_UNCONNECTED; ++ } ++ + public DatagramChannelImpl(SelectorProvider sp, FileDescriptor fd) + throws IOException + { + super(sp); ++ this.family = Net.isIPv6Available() ? ++ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; + this.fd = fd; + this.fdVal = IOUtil.fdVal(fd); + this.state = ST_UNCONNECTED; +@@ -704,4 +749,86 @@ + initIDs(); + } + ++ public SocketAddress getRemoteAddress() throws IOException { ++ synchronized (stateLock) { ++ if (!isOpen()) ++ throw new ClosedChannelException(); ++ return remoteAddress; ++ } ++ } ++ ++ public <T> DatagramChannel setOption(SocketOption<T> name, T value) ++ throws IOException ++ { ++ if (name == null) ++ throw new NullPointerException(); ++ if (!supportedOptions().contains(name)) ++ throw new UnsupportedOperationException("'" + name + "' not supported"); ++ ++ synchronized (stateLock) { ++ ensureOpen(); ++ ++ if (name == StandardSocketOption.IP_TOS) { ++ // IPv4 only; no-op for IPv6 ++ if (family == StandardProtocolFamily.INET) { ++ Net.setSocketOption(fd, family, name, value); ++ } ++ return this; ++ } ++ ++ if (name == StandardSocketOption.IP_MULTICAST_TTL || ++ name == StandardSocketOption.IP_MULTICAST_LOOP) ++ { ++ // options are protocol dependent ++ Net.setSocketOption(fd, family, name, value); ++ return this; ++ } ++ ++ if (name == StandardSocketOption.IP_MULTICAST_IF) { ++ if (value == null) ++ throw new IllegalArgumentException("Cannot set IP_MULTICAST_IF to 'null'"); ++ NetworkInterface interf = (NetworkInterface)value; ++ if (family == StandardProtocolFamily.INET6) { ++ int index = SharedSecrets.getJavaNetGetIndexAccess().getIndex(interf); ++ if (index == -1) ++ throw new IOException("Network interface cannot be identified"); ++ Net.setInterface6(fd, index); ++ } else { ++ // need IPv4 address to identify interface ++ Inet4Address target = Net.anyInet4Address(interf); ++ if (target == null) ++ throw new IOException("Network interface not configured for IPv4"); ++ int targetAddress = Net.inet4AsInt(target); ++ Net.setInterface4(fd, targetAddress); ++ } ++ return this; ++ } ++ ++ // remaining options don't need any special handling ++ Net.setSocketOption(fd, Net.UNSPEC, name, value); ++ return this; ++ } ++ } ++ ++ private static class LazyInitialization { ++ static final Set<SocketOption<?>> defaultOptions = defaultOptions(); ++ ++ private static Set<SocketOption<?>> defaultOptions() { ++ HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8); ++ set.add(StandardSocketOption.SO_SNDBUF); ++ set.add(StandardSocketOption.SO_RCVBUF); ++ set.add(StandardSocketOption.SO_REUSEADDR); ++ set.add(StandardSocketOption.SO_BROADCAST); ++ set.add(StandardSocketOption.IP_TOS); ++ set.add(StandardSocketOption.IP_MULTICAST_IF); ++ set.add(StandardSocketOption.IP_MULTICAST_TTL); ++ set.add(StandardSocketOption.IP_MULTICAST_LOOP); ++ return Collections.unmodifiableSet(set); ++ } ++ } ++ ++ public final Set<SocketOption<?>> supportedOptions() { ++ return LazyInitialization.defaultOptions; ++ } ++ + } +diff -Nru openjdk.orig/jdk/src/share/classes/sun/nio/ch/Net.java openjdk/jdk/src/share/classes/sun/nio/ch/Net.java +--- openjdk.orig/jdk/src/share/classes/sun/nio/ch/Net.java 2009-01-15 17:37:33.000000000 +0000 ++++ openjdk/jdk/src/share/classes/sun/nio/ch/Net.java 2009-01-19 13:37:55.000000000 +0000 +@@ -30,6 +30,15 @@ + import java.net.*; + import java.nio.channels.*; + ++import java.security.AccessController; ++import java.security.PrivilegedAction; ++ ++import java.util.Enumeration; ++ ++import org.classpath.icedtea.java.net.ProtocolFamily; ++import org.classpath.icedtea.java.net.SocketOption; ++import org.classpath.icedtea.java.net.StandardProtocolFamily; ++import org.classpath.icedtea.java.net.StandardSocketOption; + + class Net { // package-private + +@@ -108,16 +117,24 @@ + + // -- Socket operations -- + ++ static native boolean isIPv6Available0(); ++ + static FileDescriptor socket(boolean stream) { +- return IOUtil.newFD(socket0(stream, false)); ++ return socket(UNSPEC, stream); ++ } ++ ++ static FileDescriptor socket(ProtocolFamily family, boolean stream) { ++ boolean preferIPv6 = isIPv6Available() && ++ (family != StandardProtocolFamily.INET); ++ return IOUtil.newFD(socket0(preferIPv6, stream, false)); + } + + static FileDescriptor serverSocket(boolean stream) { +- return IOUtil.newFD(socket0(stream, true)); ++ return IOUtil.newFD(socket0(isIPv6Available(), stream, true)); + } + + // Due to oddities SO_REUSEADDR on windows reuse is ignored +- private static native int socket0(boolean stream, boolean reuse); ++ private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse); + + static native void bind(FileDescriptor fd, InetAddress addr, int port) + throws IOException; +@@ -179,4 +196,164 @@ + initIDs(); + } + ++ // From 1.7 ++ ++ static native void listen(FileDescriptor fd, int backlog) throws IOException; ++ ++ // unspecified protocol family ++ static final ProtocolFamily UNSPEC = new ProtocolFamily() { ++ public String name() { ++ return "UNSPEC"; ++ } ++ }; ++ ++ // -- Socket options ++ ++ static void setSocketOption(FileDescriptor fd, ProtocolFamily family, ++ SocketOption<?> name, Object value) ++ throws IOException ++ { ++ if (value == null) ++ throw new IllegalArgumentException("Invalid option value"); ++ ++ // only simple values supported by this method ++ Class<?> type = name.type(); ++ if (type != Integer.class && type != Boolean.class) ++ throw new AssertionError("Should not reach here"); ++ ++ // special handling ++ if (name == StandardSocketOption.SO_RCVBUF || ++ name == StandardSocketOption.SO_SNDBUF) ++ { ++ int i = ((Integer)value).intValue(); ++ if (i < 0) ++ throw new IllegalArgumentException("Invalid send/receive buffer size"); ++ } ++ if (name == StandardSocketOption.SO_LINGER) { ++ int i = ((Integer)value).intValue(); ++ if (i < 0) ++ value = Integer.valueOf(-1); ++ if (i > 65535) ++ value = Integer.valueOf(65535); ++ } ++ if (name == StandardSocketOption.IP_TOS) { ++ int i = ((Integer)value).intValue(); ++ if (i < 0 || i > 255) ++ throw new IllegalArgumentException("Invalid IP_TOS value"); ++ } ++ if (name == StandardSocketOption.IP_MULTICAST_TTL) { ++ int i = ((Integer)value).intValue(); ++ if (i < 0 || i > 255) ++ throw new IllegalArgumentException("Invalid TTL/hop value"); ++ } ++ ++ // map option name to platform level/name ++ OptionKey key = SocketOptionRegistry.findOption(name, family); ++ if (key == null) ++ throw new AssertionError("Option not found"); ++ ++ int arg; ++ if (type == Integer.class) { ++ arg = ((Integer)value).intValue(); ++ } else { ++ boolean b = ((Boolean)value).booleanValue(); ++ arg = (b) ? 1 : 0; ++ } ++ ++ boolean mayNeedConversion = (family == UNSPEC); ++ setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg); ++ } ++ ++ static Object getSocketOption(FileDescriptor fd, ProtocolFamily family, ++ SocketOption<?> name) ++ throws IOException ++ { ++ Class<?> type = name.type(); ++ ++ // only simple values supported by this method ++ if (type != Integer.class && type != Boolean.class) ++ throw new AssertionError("Should not reach here"); ++ ++ // map option name to platform level/name ++ OptionKey key = SocketOptionRegistry.findOption(name, family); ++ if (key == null) ++ throw new AssertionError("Option not found"); ++ ++ boolean mayNeedConversion = (family == UNSPEC); ++ int value = getIntOption0(fd, mayNeedConversion, key.level(), key.name()); ++ ++ if (type == Integer.class) { ++ return Integer.valueOf(value); ++ } else { ++ return (value == 0) ? Boolean.FALSE : Boolean.TRUE; ++ } ++ } ++ ++ private static native int getIntOption0(FileDescriptor fd, boolean mayNeedConversion, ++ int level, int opt) ++ throws IOException; ++ ++ private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion, ++ int level, int opt, int arg) ++ throws IOException; ++ ++ public final static int SHUT_RD = 0; ++ public final static int SHUT_WR = 1; ++ ++ static native void shutdown(FileDescriptor fd, int how) throws IOException; ++ ++ static native void setInterface6(FileDescriptor fd, int index) throws IOException; ++ ++ static native void setInterface4(FileDescriptor fd, int interf) throws IOException; ++ ++ /** ++ * Returns any IPv4 address of the given network interface, or ++ * null if the interface does not have any IPv4 addresses. ++ */ ++ static Inet4Address anyInet4Address(final NetworkInterface interf) { ++ return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() { ++ public Inet4Address run() { ++ Enumeration<InetAddress> addrs = interf.getInetAddresses(); ++ while (addrs.hasMoreElements()) { ++ InetAddress addr = addrs.nextElement(); ++ if (addr instanceof Inet4Address) { ++ return (Inet4Address)addr; ++ } ++ } ++ return null; ++ } ++ }); ++ } ++ ++ /** ++ * Returns an IPv4 address as an int. ++ */ ++ static int inet4AsInt(InetAddress ia) { ++ if (ia instanceof Inet4Address) { ++ byte[] addr = ia.getAddress(); ++ int address = addr[3] & 0xFF; ++ address |= ((addr[2] << 8) & 0xFF00); ++ address |= ((addr[1] << 16) & 0xFF0000); ++ address |= ((addr[0] << 24) & 0xFF000000); ++ return address; ++ } ++ throw new AssertionError("Should not reach here"); ++ } ++ ++ // -- Miscellaneous utilities -- ++ ++ private static volatile boolean checkedIPv6 = false; ++ private static volatile boolean isIPv6Available; ++ ++ /** ++ * Tells whether dual-IPv4/IPv6 sockets should be used. ++ */ ++ static boolean isIPv6Available() { ++ if (!checkedIPv6) { ++ isIPv6Available = isIPv6Available0(); ++ checkedIPv6 = true; ++ } ++ return isIPv6Available; ++ } ++ + } +diff -Nru openjdk.orig/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java openjdk/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java +--- openjdk.orig/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java 2009-01-16 03:01:03.000000000 +0000 ++++ openjdk/jdk/src/share/classes/sun/nio/ch/SelectorProviderImpl.java 2009-01-16 03:56:55.000000000 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -29,9 +29,18 @@ + import java.io.IOException; + import java.net.ServerSocket; + import java.net.Socket; +-import java.nio.channels.*; +-import java.nio.channels.spi.*; + ++import java.nio.channels.Pipe; ++import java.nio.channels.ServerSocketChannel; ++import java.nio.channels.SocketChannel; ++ ++import java.nio.channels.spi.AbstractSelector; ++ ++import org.classpath.icedtea.java.net.ProtocolFamily; ++ ++import org.classpath.icedtea.java.nio.channels.DatagramChannel; ++ ++import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider; + + public abstract class SelectorProviderImpl + extends SelectorProvider +@@ -41,6 +50,10 @@ + return new DatagramChannelImpl(this); + } + ++ public DatagramChannel openDatagramChannel(ProtocolFamily family) throws IOException { ++ return new DatagramChannelImpl(this, family); ++ } ++ + public Pipe openPipe() throws IOException { + return new PipeImpl(this); + } +@@ -54,5 +67,4 @@ + public SocketChannel openSocketChannel() throws IOException { + return new SocketChannelImpl(this); + } +- + } diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/util/SecurityConstants.java openjdk/jdk/src/share/classes/sun/security/util/SecurityConstants.java --- openjdk.orig/jdk/src/share/classes/sun/security/util/SecurityConstants.java 2009-01-12 17:45:26.000000000 +0000 +++ openjdk/jdk/src/share/classes/sun/security/util/SecurityConstants.java 2009-01-12 17:45:39.000000000 +0000 @@ -800,3 +1292,16 @@ public static final String SOCKET_RESOLVE_ACTION = "resolve"; public static final String SOCKET_CONNECT_ACTION = "connect"; +diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java openjdk/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java +--- openjdk.orig/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java 2009-01-19 13:29:01.000000000 +0000 ++++ openjdk/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java 2009-01-19 13:29:27.000000000 +0000 +@@ -34,7 +34,8 @@ + import java.nio.channels.SocketChannel; + import java.nio.channels.ServerSocketChannel; + import java.nio.channels.DatagramChannel; +-import java.nio.channels.spi.SelectorProvider; ++ ++import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider; + + class InheritedChannel { +