src/java.base/solaris/classes/sun/nio/ch/EventPortWrapper.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.io.IOException;
  29 import java.security.AccessController;
  30 import java.util.BitSet;
  31 import java.util.HashMap;
  32 import java.util.Map;
  33 
  34 import sun.misc.Unsafe;
  35 import sun.security.action.GetIntegerAction;
  36 import static sun.nio.ch.SolarisEventPort.*;
  37 
  38 /**
  39  * Manages a Solaris event port and manipulates a native array of pollfd structs
  40  * on Solaris.
  41  */
  42 
  43 class EventPortWrapper {
  44     private static final Unsafe unsafe = Unsafe.getUnsafe();
  45     private static final int addressSize = unsafe.addressSize();
  46 
  47     // Maximum number of open file descriptors
  48     static final int   OPEN_MAX     = IOUtil.fdLimit();
  49 
  50     // Maximum number of events to retrive in one call to port_getn
  51     static final int   POLL_MAX     =  Math.min(OPEN_MAX-1, 1024);
  52 
  53     // initial size of the array to hold pending updates
  54     private final int INITIAL_PENDING_UPDATE_SIZE = 256;




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.io.IOException;
  29 import java.security.AccessController;
  30 import java.util.BitSet;
  31 import java.util.HashMap;
  32 import java.util.Map;
  33 
  34 import jdk.internal.misc.Unsafe;
  35 import sun.security.action.GetIntegerAction;
  36 import static sun.nio.ch.SolarisEventPort.*;
  37 
  38 /**
  39  * Manages a Solaris event port and manipulates a native array of pollfd structs
  40  * on Solaris.
  41  */
  42 
  43 class EventPortWrapper {
  44     private static final Unsafe unsafe = Unsafe.getUnsafe();
  45     private static final int addressSize = unsafe.addressSize();
  46 
  47     // Maximum number of open file descriptors
  48     static final int   OPEN_MAX     = IOUtil.fdLimit();
  49 
  50     // Maximum number of events to retrive in one call to port_getn
  51     static final int   POLL_MAX     =  Math.min(OPEN_MAX-1, 1024);
  52 
  53     // initial size of the array to hold pending updates
  54     private final int INITIAL_PENDING_UPDATE_SIZE = 256;