jdk/src/share/classes/sun/nio/ch/IOUtil.java
author alanb
Wed, 28 Aug 2013 15:50:03 +0100
changeset 19607 bee007586d06
parent 16921 e70261f11307
child 23010 6dadb192ad81
permissions -rw-r--r--
8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 13024
diff changeset
     2
 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2057
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2057
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2057
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2057
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2057
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.nio.ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.FileDescriptor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.nio.ByteBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * File-descriptor based I/O utilities that are shared by NIO classes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9237
diff changeset
    37
public class IOUtil {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
    39
    /**
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
    40
     * Max number of iovec structures that readv/writev supports
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
    41
     */
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
    42
    static final int IOV_MAX;
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
    43
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private IOUtil() { }                // No instantiation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    static int write(FileDescriptor fd, ByteBuffer src, long position,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
    47
                     NativeDispatcher nd)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        if (src instanceof DirectBuffer)
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
    51
            return writeFromNativeBuffer(fd, src, position, nd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        // Substitute a native buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        int pos = src.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        int lim = src.limit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        assert (pos <= lim);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        int rem = (pos <= lim ? lim - pos : 0);
9237
cbb5753e87e7 7034155: (ch) NullPointerException in sun.io.ch.IOUtil when OOM is thrown
alanb
parents: 7668
diff changeset
    58
        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
            bb.put(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
            bb.flip();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            // Do not update src until we see how many bytes were written
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            src.position(pos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
    65
            int n = writeFromNativeBuffer(fd, bb, position, nd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            if (n > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                // now update src
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                src.position(pos + n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            return n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        } finally {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
    72
            Util.offerFirstTemporaryDirectBuffer(bb);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private static int writeFromNativeBuffer(FileDescriptor fd, ByteBuffer bb,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
    77
                                             long position, NativeDispatcher nd)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        int pos = bb.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        int lim = bb.limit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        assert (pos <= lim);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        int rem = (pos <= lim ? lim - pos : 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        int written = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (rem == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        if (position != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            written = nd.pwrite(fd,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                                ((DirectBuffer)bb).address() + pos,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
    91
                                rem, position);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            written = nd.write(fd, ((DirectBuffer)bb).address() + pos, rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        if (written > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            bb.position(pos + written);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        return written;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    static long write(FileDescriptor fd, ByteBuffer[] bufs, NativeDispatcher nd)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   103
        return write(fd, bufs, 0, bufs.length, nd);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   104
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   106
    static long write(FileDescriptor fd, ByteBuffer[] bufs, int offset, int length,
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   107
                      NativeDispatcher nd)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   108
        throws IOException
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   109
    {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   110
        IOVecWrapper vec = IOVecWrapper.get(length);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   112
        boolean completed = false;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   113
        int iov_len = 0;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   114
        try {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   115
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   116
            // Iterate over buffers to populate native iovec array.
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   117
            int count = offset + length;
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   118
            int i = offset;
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   119
            while (i < count && iov_len < IOV_MAX) {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   120
                ByteBuffer buf = bufs[i];
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   121
                int pos = buf.position();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   122
                int lim = buf.limit();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   123
                assert (pos <= lim);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   124
                int rem = (pos <= lim ? lim - pos : 0);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   125
                if (rem > 0) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   126
                    vec.setBuffer(iov_len, buf, pos, rem);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   127
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   128
                    // allocate shadow buffer to ensure I/O is done with direct buffer
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   129
                    if (!(buf instanceof DirectBuffer)) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   130
                        ByteBuffer shadow = Util.getTemporaryDirectBuffer(rem);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   131
                        shadow.put(buf);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   132
                        shadow.flip();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   133
                        vec.setShadow(iov_len, shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   134
                        buf.position(pos);  // temporarily restore position in user buffer
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   135
                        buf = shadow;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   136
                        pos = shadow.position();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   137
                    }
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   138
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   139
                    vec.putBase(iov_len, ((DirectBuffer)buf).address() + pos);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   140
                    vec.putLen(iov_len, rem);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   141
                    iov_len++;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   142
                }
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   143
                i++;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   144
            }
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   145
            if (iov_len == 0)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   146
                return 0L;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   147
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   148
            long bytesWritten = nd.writev(fd, vec.address, iov_len);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   149
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   150
            // Notify the buffers how many bytes were taken
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   151
            long left = bytesWritten;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   152
            for (int j=0; j<iov_len; j++) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   153
                if (left > 0) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   154
                    ByteBuffer buf = vec.getBuffer(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   155
                    int pos = vec.getPosition(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   156
                    int rem = vec.getRemaining(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   157
                    int n = (left > rem) ? rem : (int)left;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   158
                    buf.position(pos + n);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   159
                    left -= n;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   160
                }
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   161
                // return shadow buffers to buffer pool
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   162
                ByteBuffer shadow = vec.getShadow(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   163
                if (shadow != null)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   164
                    Util.offerLastTemporaryDirectBuffer(shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   165
                vec.clearRefs(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   166
            }
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   167
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   168
            completed = true;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   169
            return bytesWritten;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   170
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   171
        } finally {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   172
            // if an error occurred then clear refs to buffers and return any shadow
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   173
            // buffers to cache
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   174
            if (!completed) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   175
                for (int j=0; j<iov_len; j++) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   176
                    ByteBuffer shadow = vec.getShadow(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   177
                    if (shadow != null)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   178
                        Util.offerLastTemporaryDirectBuffer(shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   179
                    vec.clearRefs(j);
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   180
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    static int read(FileDescriptor fd, ByteBuffer dst, long position,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
   186
                    NativeDispatcher nd)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        if (dst.isReadOnly())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            throw new IllegalArgumentException("Read-only buffer");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        if (dst instanceof DirectBuffer)
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
   192
            return readIntoNativeBuffer(fd, dst, position, nd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        // Substitute a native buffer
9237
cbb5753e87e7 7034155: (ch) NullPointerException in sun.io.ch.IOUtil when OOM is thrown
alanb
parents: 7668
diff changeset
   195
        ByteBuffer bb = Util.getTemporaryDirectBuffer(dst.remaining());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        try {
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
   197
            int n = readIntoNativeBuffer(fd, bb, position, nd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            bb.flip();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            if (n > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                dst.put(bb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            return n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        } finally {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   203
            Util.offerFirstTemporaryDirectBuffer(bb);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    private static int readIntoNativeBuffer(FileDescriptor fd, ByteBuffer bb,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
   208
                                            long position, NativeDispatcher nd)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        int pos = bb.position();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        int lim = bb.limit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        assert (pos <= lim);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        int rem = (pos <= lim ? lim - pos : 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        if (rem == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        int n = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        if (position != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            n = nd.pread(fd, ((DirectBuffer)bb).address() + pos,
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 14342
diff changeset
   221
                         rem, position);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            n = nd.read(fd, ((DirectBuffer)bb).address() + pos, rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (n > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            bb.position(pos + n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    static long read(FileDescriptor fd, ByteBuffer[] bufs, NativeDispatcher nd)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   233
        return read(fd, bufs, 0, bufs.length, nd);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   234
    }
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   235
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   236
    static long read(FileDescriptor fd, ByteBuffer[] bufs, int offset, int length,
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   237
                     NativeDispatcher nd)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   238
        throws IOException
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   239
    {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   240
        IOVecWrapper vec = IOVecWrapper.get(length);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   241
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   242
        boolean completed = false;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   243
        int iov_len = 0;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   244
        try {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   246
            // Iterate over buffers to populate native iovec array.
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   247
            int count = offset + length;
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   248
            int i = offset;
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   249
            while (i < count && iov_len < IOV_MAX) {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   250
                ByteBuffer buf = bufs[i];
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   251
                if (buf.isReadOnly())
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   252
                    throw new IllegalArgumentException("Read-only buffer");
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   253
                int pos = buf.position();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   254
                int lim = buf.limit();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   255
                assert (pos <= lim);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   256
                int rem = (pos <= lim ? lim - pos : 0);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   257
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   258
                if (rem > 0) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   259
                    vec.setBuffer(iov_len, buf, pos, rem);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   261
                    // allocate shadow buffer to ensure I/O is done with direct buffer
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   262
                    if (!(buf instanceof DirectBuffer)) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   263
                        ByteBuffer shadow = Util.getTemporaryDirectBuffer(rem);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   264
                        vec.setShadow(iov_len, shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   265
                        buf = shadow;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   266
                        pos = shadow.position();
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   267
                    }
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   268
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   269
                    vec.putBase(iov_len, ((DirectBuffer)buf).address() + pos);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   270
                    vec.putLen(iov_len, rem);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   271
                    iov_len++;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   272
                }
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   273
                i++;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            }
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   275
            if (iov_len == 0)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   276
                return 0L;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   277
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   278
            long bytesRead = nd.readv(fd, vec.address, iov_len);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   279
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   280
            // Notify the buffers how many bytes were read
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   281
            long left = bytesRead;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   282
            for (int j=0; j<iov_len; j++) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   283
                ByteBuffer shadow = vec.getShadow(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   284
                if (left > 0) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   285
                    ByteBuffer buf = vec.getBuffer(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   286
                    int rem = vec.getRemaining(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   287
                    int n = (left > rem) ? rem : (int)left;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   288
                    if (shadow == null) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   289
                        int pos = vec.getPosition(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   290
                        buf.position(pos + n);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   291
                    } else {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   292
                        shadow.limit(shadow.position() + n);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   293
                        buf.put(shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   294
                    }
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   295
                    left -= n;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   296
                }
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   297
                if (shadow != null)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   298
                    Util.offerLastTemporaryDirectBuffer(shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   299
                vec.clearRefs(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   300
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   302
            completed = true;
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   303
            return bytesRead;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   305
        } finally {
6301
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   306
            // if an error occurred then clear refs to buffers and return any shadow
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   307
            // buffers to cache
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   308
            if (!completed) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   309
                for (int j=0; j<iov_len; j++) {
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   310
                    ByteBuffer shadow = vec.getShadow(j);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   311
                    if (shadow != null)
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   312
                        Util.offerLastTemporaryDirectBuffer(shadow);
c90a67d75c9f 6971825: (so) improve scatter/gather implementation
alanb
parents: 5506
diff changeset
   313
                    vec.clearRefs(j);
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   314
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9237
diff changeset
   319
    public static FileDescriptor newFD(int i) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        FileDescriptor fd = new FileDescriptor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        setfdVal(fd, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        return fd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    static native boolean randomBytes(byte[] someBytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
6520
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   327
    /**
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   328
     * Returns two file descriptors for a pipe encoded in a long.
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   329
     * The read end of the pipe is returned in the high 32 bits,
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   330
     * while the write end is returned in the low 32 bits.
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   331
     */
0e7cf575332e 6981145: (se) Eliminate JNI*Critical when creating pipes and other cleanups
martin
parents: 6301
diff changeset
   332
    static native long makePipe(boolean blocking);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    static native boolean drain(int fd) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9237
diff changeset
   336
    public static native void configureBlocking(FileDescriptor fd,
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9237
diff changeset
   337
                                                boolean blocking)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9237
diff changeset
   340
    public static native int fdVal(FileDescriptor fd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    static native void setfdVal(FileDescriptor fd, int value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
12872
16fa902b1469 7172826: (se) Selector based on the Solaris event port mechanism
alanb
parents: 11823
diff changeset
   344
    static native int fdLimit();
16fa902b1469 7172826: (se) Selector based on the Solaris event port mechanism
alanb
parents: 11823
diff changeset
   345
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   346
    static native int iovMax();
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   347
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    static native void initIDs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
19607
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   350
    /**
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   351
     * Used to trigger loading of native libraries
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   352
     */
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   353
    public static void load() { }
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   354
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    static {
19607
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   356
        java.security.AccessController.doPrivileged(
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   357
                new java.security.PrivilegedAction<Void>() {
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   358
                    public Void run() {
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   359
                        System.loadLibrary("net");
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   360
                        System.loadLibrary("nio");
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   361
                        return null;
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   362
                    }
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   363
                });
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   364
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   365
        initIDs();
bee007586d06 8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
alanb
parents: 16921
diff changeset
   366
13024
ada1a7c54e84 7176485: (bf) Allow temporary buffer cache to grow to IOV_MAX
alanb
parents: 12872
diff changeset
   367
        IOV_MAX = iovMax();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
}