jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
author alanb
Sun, 07 Dec 2014 07:10:29 +0000
changeset 27937 0c9f63e42e91
parent 27263 819f5f87d485
child 28303 641c5c22c491
permissions -rw-r--r--
8064407: (fc) FileChannel transferTo should use TransmitFile on Windows Reviewed-by: alanb Contributed-by: kirk.shoop@microsoft.com, v-valkop@microsoft.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 19607
diff changeset
     2
 * Copyright (c) 2000, 2013, 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
27937
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    28
import java.io.FileDescriptor;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    29
import java.io.IOException;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    30
import java.security.PrivilegedAction;
7025
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
    31
import sun.misc.SharedSecrets;
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
    32
import sun.misc.JavaIOFileDescriptorAccess;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
27937
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    34
class FileDispatcherImpl extends FileDispatcher {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    35
27263
819f5f87d485 8023173: FileDescriptor should respect append flag
igerasim
parents: 25859
diff changeset
    36
    private static final JavaIOFileDescriptorAccess fdAccess =
819f5f87d485 8023173: FileDescriptor should respect append flag
igerasim
parents: 25859
diff changeset
    37
        SharedSecrets.getJavaIOFileDescriptorAccess();
819f5f87d485 8023173: FileDescriptor should respect append flag
igerasim
parents: 25859
diff changeset
    38
27937
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    39
    // set to true if fast file transmission (TransmitFile) is enabled
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    40
    private static final boolean fastFileTransfer;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
27937
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
    42
    FileDispatcherImpl() { }
7515
43202796198e 6709457: (fc) lock/tryLock() throws IOException "Access is denied" when file opened for append [win]
alanb
parents: 7025
diff changeset
    43
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    44
    @Override
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    45
    boolean needsPositionLock() {
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    46
        return true;
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    47
    }
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    48
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    int read(FileDescriptor fd, long address, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        return read0(fd, address, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    55
    int pread(FileDescriptor fd, long address, int len, long position)
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    56
        throws IOException
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    {
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    58
        return pread0(fd, address, len, position);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    long readv(FileDescriptor fd, long address, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        return readv0(fd, address, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    int write(FileDescriptor fd, long address, int len) throws IOException {
27263
819f5f87d485 8023173: FileDescriptor should respect append flag
igerasim
parents: 25859
diff changeset
    66
        return write0(fd, address, len, fdAccess.getAppend(fd));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    69
    int pwrite(FileDescriptor fd, long address, int len, long position)
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    70
        throws IOException
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    {
16921
e70261f11307 8012019: (fc) Thread.interrupt triggers hang in FileChannelImpl.pread (win)
alanb
parents: 7668
diff changeset
    72
        return pwrite0(fd, address, len, position);
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
    long writev(FileDescriptor fd, long address, int len) throws IOException {
27263
819f5f87d485 8023173: FileDescriptor should respect append flag
igerasim
parents: 25859
diff changeset
    76
        return writev0(fd, address, len, fdAccess.getAppend(fd));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    79
    int force(FileDescriptor fd, boolean metaData) throws IOException {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    80
        return force0(fd, metaData);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    81
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    82
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    83
    int truncate(FileDescriptor fd, long size) throws IOException {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    84
        return truncate0(fd, size);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    85
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    86
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    87
    long size(FileDescriptor fd) throws IOException {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    88
        return size0(fd);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    89
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    90
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    91
    int lock(FileDescriptor fd, boolean blocking, long pos, long size,
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    92
             boolean shared) throws IOException
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    93
    {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    94
        return lock0(fd, blocking, pos, size, shared);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    95
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    96
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    97
    void release(FileDescriptor fd, long pos, long size) throws IOException {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    98
        release0(fd, pos, size);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
    99
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   100
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    void close(FileDescriptor fd) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        close0(fd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
7025
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   105
    FileDescriptor duplicateForMapping(FileDescriptor fd) throws IOException {
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   106
        // on Windows we need to keep a handle to the file
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   107
        FileDescriptor result = new FileDescriptor();
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   108
        long handle = duplicateHandle(fdAccess.getHandle(fd));
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   109
        fdAccess.setHandle(result, handle);
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   110
        return result;
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   111
    }
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   112
27937
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   113
    boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   114
        return fastFileTransfer && sc.isBlocking();
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   115
    }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   116
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   117
    boolean transferToDirectlyNeedsPositionLock() {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   118
        return true;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   119
    }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   120
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   121
    static boolean isFastFileTransferRequested() {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   122
        String fileTransferProp = java.security.AccessController.doPrivileged(
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   123
            new PrivilegedAction<String>() {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   124
                @Override
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   125
                public String run() {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   126
                    return System.getProperty("jdk.net.enableFastFileTransfer");
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   127
                }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   128
            });
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   129
        boolean enable;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   130
        if ("".equals(fileTransferProp)) {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   131
            enable = true;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   132
        } else {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   133
            enable = Boolean.parseBoolean(fileTransferProp);
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   134
        }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   135
        return enable;
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   136
    }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   137
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   138
    static {
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   139
        IOUtil.load();
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   140
        fastFileTransfer = isFastFileTransferRequested();
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   141
    }
0c9f63e42e91 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows
alanb
parents: 27263
diff changeset
   142
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    //-- Native methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    static native int read0(FileDescriptor fd, long address, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    static native int pread0(FileDescriptor fd, long address, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                             long position) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    static native long readv0(FileDescriptor fd, long address, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
7515
43202796198e 6709457: (fc) lock/tryLock() throws IOException "Access is denied" when file opened for append [win]
alanb
parents: 7025
diff changeset
   154
    static native int write0(FileDescriptor fd, long address, int len, boolean append)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    static native int pwrite0(FileDescriptor fd, long address, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                             long position) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
7515
43202796198e 6709457: (fc) lock/tryLock() throws IOException "Access is denied" when file opened for append [win]
alanb
parents: 7025
diff changeset
   160
    static native long writev0(FileDescriptor fd, long address, int len, boolean append)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   163
    static native int force0(FileDescriptor fd, boolean metaData)
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   164
        throws IOException;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   165
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   166
    static native int truncate0(FileDescriptor fd, long size)
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   167
        throws IOException;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   168
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   169
    static native long size0(FileDescriptor fd) throws IOException;
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
    static native int lock0(FileDescriptor fd, boolean blocking, long pos,
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   172
                            long size, boolean shared) throws IOException;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   173
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   174
    static native void release0(FileDescriptor fd, long pos, long size)
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   175
        throws IOException;
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents: 2
diff changeset
   176
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    static native void close0(FileDescriptor fd) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    static native void closeByHandle(long fd) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
7025
6e002f9a2899 6816049: (bf) MappedByteBuffer.force() method does not flush data correctly
alanb
parents: 5506
diff changeset
   181
    static native long duplicateHandle(long fd) throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
}